PascalABC.NET is a
Pascal programming language that implements classic Pascal, most Delphi language features, as well as a number of their own extensions. It is implemented on the
.NET Framework
The .NET Framework (pronounced as "''dot net"'') is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until bein ...
platform and contains all the modern language features, such as classes,
operator overloading, interfaces,
exception handling,
generic classes and routines,
garbage collection
Waste collection is a part of the process of waste management. It is the transfer of solid waste from the point of use and disposal to the point of treatment or landfill. Waste collection also includes the curbside collection of recyclable m ...
,
lambda expressions Lambda expression may refer to:
*Lambda expression in computer programming, also called an anonymous function
In computer programming, an anonymous function (function literal, lambda abstraction, lambda function, lambda expression or block) is a f ...
, parallel programming tools (
OpenMP only as of 2016).
PascalABC.NET is also a simple and powerful
integrated development environment
An integrated development environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of at least a source code editor, build automation tools a ...
with an integrated debugger, IntelliSense system,
form designer, code templates and code auto-formatting. The command-line PascalABC.NET compiler is also available on Linux and MacOS (under Mono).
PascalABC.NET is popular in Russian schools and universities. In the Southern Federal University, it is used as the main language for teaching students of Information Technology in the course "Fundamentals of programming", and for teaching children in one of the largest computer schools in Russia.
Key features of PascalABC.NET
Pascal language extensions
* Operators
+= -= *= /=
* in-block variable definitions
* Variable declaration in
for
loop header
* Variable declaration with initialization (
var n: integer := 10;
)
* Variable type deduction (
var x := 1;
)
*
foreach
In computer programming, foreach loop (or for each loop) is a control flow statement for traversing items in a collection. is usually used in place of a standard loop statement. Unlike other loop constructs, however, loops usually maintai ...
* Routines with a variable number of parameters
*
set
of any type (
set of integer
)
* Methods in records
* Methods defined in class declaration
* Simplified syntax of units
* Keyword
new
(invoking a constructor)
* Field initializers
* Operator overloading
* Static constructors
* Directives
OpenMP
* case for strings
* function type syntax T->T
* tuple type syntax (T1, T2)
* yield and yield sequence
* pattern matching
* array slices
* interpolated strings
* unpacking of parameters of lambda expressions into variables
System units
Most units are focused on education:
* Raster graphics units GraphABC (based on Windows Forms), GraphWPF (based on WPF)
* Vector graphics units ABCObjects (based on Windows Forms), WPFObjects (based on WPF)
* 3D graphics & animation unit Graph3D (based on the Helix Toolkit library)
* Unit FormsABC to create simple windows application without form designer
* Units-executors Robot and Drawman (school computer science)
Samples
1. Swap the first and second halves of an array
begin
var a := ArrGen(10,i->2*i+1);
a.Println;
Assert(a.Length mod 2 = 0);
var n := a.Length div 2;
a := a :+ a n
a.Println;
end.
2. 100!
begin
var p: BigInteger := 1;
for var i:=1 to 100 do
p := p * i;
Println(p);
end.
3. Greater common divisor of two integers
begin
var (a, b) := ReadInteger2;
while b > 0 do
(a, b) := (b, a mod b);
var GCD := Abs(a);
GCD.Print;
end.
4. Display all Fibonacci numbers less than 1000
begin
SeqWhile(1,1,(x,y)->x+y,x->x<1000).Print;
end.
5. Word frequency dictionary for a file
begin
var d := new Dictionary;
foreach var s in ReadLines('words.txt') do
foreach var word in s.ToWords do
d ord:= d.Get(word) + 1;
d.PrintLines;
end.
5а. Word frequency dictionary for a file - Solution in functional style
begin
ReadLines('words.txt').SelectMany(s->s.ToWords).GroupBy(v->v).EachCount.PrintLines;
end.
6. Parallel matrix multiplication using OpenMP directives
procedure Mult(a,b,c: array of real; n: integer);
begin
for var i:=0 to n-1 do
for var j:=0 to n-1 do
begin
var cc := 0.0;
for var l:=0 to n-1 do
cc += a ,lb ,j
c ,j:= cc;
end;
end;
const n = 1000;
begin
var a := MatrixRandomReal(n,n,1,1.1);
var b := MatrixRandomReal(n,n,1,1.1);
var c := new real ,n
Mult(a,b,c,n);
Println(MillisecondsDelta/1000);
end.
See also
*
Object Pascal
Object Pascal is an extension to the programming language Pascal that provides object-oriented programming (OOP) features such as classes and methods.
The language was originally developed by Apple Computer as ''Clascal'' for the Lisa Works ...
*
C#
References
External links
*
PascalABC.NET Github RepositoryOfficial 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
Statically typed programming languages