PascalABC.NET
This article may have been previously nominated for deletion: Wikipedia:Articles for deletion/PascalABC.NET exists. It is proposed that this article be deleted because of the following concern:
If you can address this concern by improving, copyediting, sourcing, renaming, or merging the page, please edit this page and do so. You may remove this message if you improve the article or otherwise object to deletion for any reason. Although not required, you are encouraged to explain why you object to the deletion, either in your edit summary or on the talk page. If this template is removed, do not replace it. This message has remained in place for seven days, so the article may be deleted without further notice. Find sources: "PascalABC.NET" – news · newspapers · books · scholar · JSTOR Nominator: Please consider notifying the author/project: {{subst:proposed deletion notify|PascalABC.NET|concern=No citations (with "more citations needed" template added in April 2016), does not seem to be notable (most hits on the first 5 pages of Google are auto-generated or self-created, only 10 [https://stackoverflow.com/search?q=pascalabc.net StackOverflow questions]), conflict of interest (article created and edited primarily by two of the software’s authors).}} ~~~~ Timestamp: 20230402125650 12:56, 2 April 2023 (UTC) Administrators: delete |
![]() | This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these messages)
|
Paradigm | Multi-paradigm: procedural, functional, object-oriented, generic |
---|---|
Designed by | S.S. Mikhalkovich, Ivan Bondarev, A.V. Tkachuk, S.O. Ivanov |
First appeared | 2007 |
Stable release | 3.8.3.3167
/ 30 August 2022 |
Typing discipline | Static, partially inferred |
Implementation language | PascalABC.NET |
OS | Cross-platform |
License | LGPLv3 |
Filename extensions | .pas |
Website | pascalabc |
Influenced by | |
Delphi, Pascal, Oxygene, C#, Python, Kotlin, Haskell |
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 platform and contains all the modern language features, such as classes, operator overloading, interfaces, exception handling, generic classes and routines, garbage collection, lambda expressions, parallel programming tools (OpenMP only as of 2016).
PascalABC.NET is also a simple and powerful integrated development environment 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).[1]
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.
Use in school and university education
Designed for education, PascalABC.NET remains the most common programming language in Russian schools. Its advantages are readability, code brevity, the ability to develop both computational algorithms and graphics-oriented programs. PascalABC.NET is also widely used as a basic programming language in pedagogical universities for the training of computer science teachers.[2] [3] [4]
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
- 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
Functional style programming
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:
var f: real -> real := x -> x*x;
Here is an example of superposition of two functions:
function Super<T,T1,T2>(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"[5] and in the corresponding video tutorials[6][7], Dr. Kevin Bond, a programmer and a Computer Science teaching specialist[8], notes that PascalABC.NET has powerful functional programming capabilities which are missing in Delphi. As an example, partial function application is demonstrated:
var f: real -> real -> real := x -> y -> x + y;
Print(f(2)(3));
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)
Code examples
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[n:] + 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<string,integer>;
foreach var s in ReadLines('words.txt') do
foreach var word in s.ToWords do
d[word] := 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
{$omp parallel for}
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[i,l]*b[l,j];
c[i,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,n];
Mult(a,b,c,n);
Println(MillisecondsDelta/1000);
end.
Code audit
In 2017[9] and 2022[10], independent audit of PascalABC.NET public repository was 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.
See also
References
- ^ "Pascalabcnet/Pascalabcnet". GitHub. 24 October 2021.
- ^ Dzhenzher, V.O.; Denisova, L.V. "Mathematical animation in computer simulation at school". www.sciencegate.app. Informatics in school, 2019; (6). pp. 51–54. doi:10.32517/2221-1993-2019-18-6-51-54. Retrieved 4 April 2023.
- ^ Dzhenzher, V.O.; Denisova, L.V. "Implementation of the Hamming code on PascalABC.NET while studying the theoretical foundations of informatics". www.sciencegate.app. Informatics in school, 2021; 1(9). pp. 29–38. doi:10.32517/2221-1993-2021-20-9-27-36. Retrieved 4 April 2023.
- ^ Dzhenzher, V.O.; Denisova, L.V. "Scientific graphics in PascalABC.NET: plotting function graphs in a rectangular cartesian coordinate system". www.sciencegate.app. Informatics in school. 2020; (1). pp. 31–39. doi:10.32517/2221-1993-2020-19-1-31-39. Retrieved 4 April 2023.
- ^ Kevin R. Bond (2021). "Chapter 44. Anonymous methods". How to Program Effectively in Delphi for AS/A Level Computer Science. Educational Computing Services Ltd. p. 1200.
- ^ Kevin Bond. "How to Program Effectively in Delphi. Lesson 44. Part 1". Retrieved 4 April 2023.
- ^ "Delphi Boot Camp 2022 - Delphi and functional programming using anonymous methods". Retrieved 4 April 2023.
- ^ "Brief biography Dr Kevin R Bond" (PDF). Educational Computing Services Ltd.
- ^ "Analysis of PascalABC.NET using SonarQube plugins: SonarC# and PVS-Studio". PVS-Studio. 29 March 2017.
- ^ "Re-checking PascalABC.NET". Medium. 11 February 2022.
External links