PascalABC.NET is a
high-level general-purpose programming language
A programming language is a system of notation for writing computer programs.
Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
supporting multiple paradigms. PascalABC.NET is based on
Delphi
Delphi (; ), in legend previously called Pytho (Πυθώ), was an ancient sacred precinct and the seat of Pythia, the major oracle who was consulted about important decisions throughout the ancient Classical antiquity, classical world. The A ...
's
Object Pascal
Object Pascal is an extension to the programming language Pascal (programming language), Pascal that provides object-oriented programming (OOP) features such as Class (computer programming), classes and Method (computer programming), methods.
T ...
, but also has influences from
C#,
Python,
Kotlin, and
Haskell
Haskell () is a general-purpose, statically typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research, and industrial applications, Haskell pioneered several programming language ...
. It is distributed both as a command-line tool for Windows (
.NET
The .NET platform (pronounced as "''dot net"'') is a free and open-source, managed code, managed computer software framework for Microsoft Windows, Windows, Linux, and macOS operating systems. The project is mainly developed by Microsoft emplo ...
framework), Linux and MacOS (Mono), and with an
integrated development environment
An integrated development environment (IDE) is a Application software, software application that provides comprehensive facilities for software development. An IDE normally consists of at least a source-code editor, build automation tools, an ...
for Windows and Linux, including interactive debugger,
IntelliSense system,
form designer, code templates and code auto-formatting.
PascalABC.NET is implemented for the
.NET
The .NET platform (pronounced as "''dot net"'') is a free and open-source, managed code, managed computer software framework for Microsoft Windows, Windows, Linux, and macOS operating systems. The project is mainly developed by Microsoft emplo ...
framework platform, so that it is compatible with all .NET libraries and utilizes all the features of
Common Language Runtime
The Common Language Runtime (CLR), the virtual machine component of Microsoft .NET Framework, manages the execution of .NET programs. Just-in-time compilation converts the managed code (compiled intermediate language code) into machine instr ...
, such as
garbage collection,
exception handling
In computing and computer programming, exception handling is the process of responding to the occurrence of ''exceptions'' – anomalous or exceptional conditions requiring special processing – during the execution of a program. In general, an ...
, and
generics. Some language constructions, e.g. tuples, sequences, and lambdas, are based on regular .NET types. PascalABC.NET is ideologically close to
Oxygene, but unlike it, provides high compatibility with
Delphi
Delphi (; ), in legend previously called Pytho (Πυθώ), was an ancient sacred precinct and the seat of Pythia, the major oracle who was consulted about important decisions throughout the ancient Classical antiquity, classical world. The A ...
.
History of PascalABC.NET
PascalABC.NET was developed by a group of enthusiasts at the Institute of Mathematics, Mechanics, and Computer Science in Rostov-on-Don, Russia.
In 2003, a predecessor of the modern PascalABC.NET, called Pascal ABC, was implemented by associate professor Stanislav Mikhalkovich to be used for teaching schoolchildren instead of
Turbo Pascal
Turbo Pascal is a software development system that includes a compiler and an integrated development environment (IDE) for the programming language Pascal (programming language), Pascal running on the operating systems CP/M, CP/M-86, and MS-DOS. ...
, which became outdated and incompatible with modern operating systems but was still used for educational purposes. Pascal ABC was implemented as an
interpreted programming language, that led to a significant lack of performance. Four years after that it was completely rewritten by students Ivan Bondarev, Alexander Tkachuk, and Sergey Ivanov as a
compiled programming language for the .NET platform. In 2009, PascalABC.NET started to be actively used for teaching high school students. By 2015, the number of users of the language had increased significantly. It began to be actively used throughout Russia in schools and at programming contests, surpassing
Free Pascal
Free Pascal Compiler (FPC) is a compiler for the closely related programming-language dialects Pascal and Object Pascal. It is free software released under the GNU General Public License, witexception clausesthat allow static linking against it ...
. Since then, the PascalABC.NET developers have set themselves the goal of actively incorporating modern features into the language. In the same year, PascalABC.NET became an open source project distributed under the
GNU Lesser General Public License
The GNU Lesser General Public License (LGPL) is a free-software license published by the Free Software Foundation (FSF). The license allows developers and companies to use and integrate a software component released under the LGPL into their own ...
(LGPLv3).
In 2017 and 2022, independent audit o
PascalABC.NET public repositorywas conducted. Based on the results of the static check, potentially dangerous code fragments were listed that require additional analysis by developers. It was also noted that the overall quality of the code could be improved. To do this, code duplication and redundant checks should be eliminated, and refactoring should be performed more carefully.
Use in school and higher education
Designed for education, PascalABC.NET remains the most common programming language in Russian schools and one of the recommended languages for passing the
Unified State Exam on informatics.
In the Southern Federal University, it is used as the first language for teaching students majoring in computer science, and for teaching children in one of the largest computer schools in Russia. PascalABC.NET is widely used as a basic programming language in pedagogical universities for the training of computer science teachers.
It also serves as a tool for scientific computing. PascalABC.NET is also built into a number of validation systems used for programming competitions.
In 2020, during anti-COVID lockdowns and home schooling period, PascalABC.NET website was ranked 3rd in Yandex traffic rating in the "Programming" category, and the number of downloads of the installation kit exceeded 10000 a day.
Though the core of the PascalABC.NET community is located in Russia, the language is also known in other countries such as Belarus, Romania, Indonesia, Algeria.
Language syntax
Differences between Delphi and PascalABC.NET
New features
•
loop
statement
loop 10 do
Write('*');
•
for
loop with a step
for var i:=1 to 20 step 2 do
Print(i);
•
foreach
loop with an index
foreach var c in Arr('a'..'z') index i do
if i mod 2 = 0 then
Print(c);
•
a..b
ranges
(1..10).Printlines
• short function definition syntax
function Sum(a,b: real) := a + b;
• method implementation can be placed inside a class definition
type Point = class
x,y: real;
procedure Output;
begin
Print(x,y);
end;
end;
•
sequence of T
type as an abstraction of arrays, lists and sets
var seq: sequence of integer := Arr(1..10);
seq.Println;
seq := Lst(11..100); seq.Println;
seq := HSet(1..20); seq.Println;
•
lambda functions
var a := ArrGen(10,i -> i*i);
• auto classes - classes with an automatically generated constructor
type Point = auto class
x,y: real;
end;
var p := new Point(2,5);
• one-dimensional and multi-dimensional array slices
var m: array of integer := MatrGen(3,4, (i,j) -> i+j+1);
Println(m); // 1,2,3,4 ,3,4,5 ,4,5,6
Println(m 2,1:3; // 2,3 ,4
Some other features such as inline variable declarations, type inference, and
for
statement with a variable declaration are standard in the current version of Delphi. However, PascalABC.NET pioneered these features in 2007,
while in Delphi they were implemented in 2018.
Changed features
* strings in
case
statements
* sets based on arbitrary type:
set of string
* constructors can be invoked with
new T(...)
syntax
* type extension methods instead of class helpers
* modules can be defined in a simplified form (without
interface
and
implementation
sections)
Not implemented features
* records with variant parts
* open arrays
* nested class definitions
*
inline assembly code
Functional style features
In PascalABC.NET, functions are
first-class objects. They can be assigned to variables, passed as parameters, and returned from other functions. Functional type is set in the form
T -> Res
. An
anonymous function can be assigned to the variable of this type:
## // denotes that the main program will be written without enclosing begin-end
var f: real -> real := x -> x*x;
Here is an example of
superposition of two functions:
##
function Super(f: T1 -> T2; g: T -> T1): T -> T2 := x -> f(g(x));
var f: real -> real := x -> x*x;
var fg := Super(f,Sin);
var gf := Super(Sin,f);
Print(fg(2));
Print(gf(2));
Superposition operation is defined in the standard library:
##
var f: real -> real := x -> x*x;
Print((f*Cos)(2));
Print((Cos*f)(2));
In the book "How To Program Effectively In Delphi" and in the corresponding video tutorials,
Dr. Kevin Bond, a programmer and a Computer Science teaching specialist, notes that PascalABC.NET has powerful functional programming capabilities which are missing in Delphi. As an example,
partial function application is demonstrated:
begin
var f: integer -> integer -> integer := x -> y -> x + y;
Writeln(f(2)(6));
end.
Code examples
PascalABC.NET is a multi-paradigm programming language. It allows one to use different coding styles from oldschool Pascal to functional and object-oriented programming. The same task can be solved in different styles as follows:
Usual PascalABC.NET style
begin
var (a,b) := ReadInteger2; // read input into tuple of two variables
var sum := 0; // type auto-inference
for var i:=a to b do
sum += i*i;
Print($'Sum = ') // string interpolation
end.
Procedural style
function SumSquares(a,b: integer): integer;
begin
Result := 0;
for var i := a to b do
Result += i * i
end;
begin
var (a,b) := ReadInteger2;
Print($'Sum = ')
end.
Functional style
This solution uses .NET extension methods for sequences and PascalABC.NET-specific range
(a..b)
.
begin
var (a,b) := ReadInteger2;
(a..b).Sum(x -> x*x).Print // method chaining with lambda expressions
end.
Object-oriented style
This solution demonstrates PascalABC.NET-specific short function definition style.
type Algorithms = class
static function SumSquares(a,b: integer) := (a..b).Sum(x -> x*x);
static function SumCubes(a,b: integer) := (a..b).Sum(x -> x*x*x);
end;
begin
var (a,b) := ReadInteger2;
Println($'Squares sum = ');
Println($'Cubes sum = ')
end.
Close to regular C# style
It is possible to write programs without usage of PascalABC.NET standard library. All standard .NET Framework classes and methods can be used directly.
uses System; // using .NET System namespace
begin
var arr := Console.ReadLine.Split(
new char[](' '),
StringSplitOptions.RemoveEmptyEntries
);
var (a,b) := (integer.Parse(arr[0]),integer.Parse(arr[1]));
var sum := 0;
for var i:=a to b do
sum += i*i;
Console.WriteLine($'Sum = ')
end.
Criticism
Though PascalABC.NET is actively used for teacher training,
some members of the teaching community ignore difference between historically used Turbo Pascal and PascalABC.NET, criticizing some unspecified "Pascal" language for being far from modern programming, too wordy and not simple enough to be used as the first programming language. They consider Python to be the best starting point, as it is more concise and practically applicable. Their opponents, including PascalABC.NET developers themselves, argue that it is incorrect to put an equal sign between the classic Pascal and PascalABC.NET, as the latter contains lots of modern multi-paradigm features, including the ones from Python.
PascalABC.NET allows students to write as concise and expressive programs as Python, and acts as a "bridge to production programming" by applying a static typing concept.
PascalABC.NET is also a compilable language, which makes it easier to learn programming, because all semantic errors are caught at compile time rather than occur unpredictably at runtime.
Pascal is often regarded as a strictly structured programming language, which makes it a popular choice for introductory programming education. However, some authors argue that the promotion of Python as a beginner-friendly language is driven, in part, by commercial interests.
References
External links
*
*
Official Telegram Channel ''PascalABC.NET''
{{GUI builders
Object-oriented programming languages
Class-based programming languages
.NET programming languages
Pascal (programming language) compilers
Pascal programming language family
Educational programming languages
Statically typed programming languages
Linux integrated development environments
Free integrated development environments