Rev | Author | # | Line |
---|---|---|---|
15 | AristotlePagaltzis | 1 | An imperative ProgrammingLanguage designed by NicolasWirth as a teaching language. Once very popular in schools before students started whining that they wanted to learn [C]. The ancestor of the language in [Borland]'s [Delphi] and [Kylix] [GUI] development environments, which added ObjectOrientation. |
2 | |||
3 | !!! A Sample | ||
4 | |||
20 | GlynWebster | 5 | <verbatim> |
6 | function plural (noun : string) : string; | ||
21 | LawrenceDoliveiro | 7 | { Returns the plural version of a noun. } |
8 | var | ||
9 | i : integer; | ||
10 | begin | ||
11 | case noun[[length(noun)] of | ||
20 | GlynWebster | 12 | 's': if noun[[length(noun)-1] = 'e' then |
13 | plural := noun | ||
14 | else | ||
15 | plural := noun + 'es'; | ||
16 | 'y': begin | ||
17 | delete(noun, length(noun), 1); | ||
18 | plural := noun + 'ies'; | ||
19 | end; | ||
20 | else plural := noun + 's'; | ||
21 | end; | ||
21 | LawrenceDoliveiro | 22 | end; {plural} |
20 | GlynWebster | 23 | </verbatim> |
15 | AristotlePagaltzis | 24 | |
25 | (This is in the TurboPascal dialect of Pascal.) | ||
26 | |||
27 | !!! History | ||
28 | |||
29 | Pascal became popular very quickly because the original compiler was designed to be very easy to [Port]. It was written in Pascal and compiled to [ByteCode]s, called ''P-Code''. All anyone had to do to get a Pascal compiler working on a new machine was to write the simple P-Code VirtualMachine for it -- they could hack the compiler around to generate proper MachineCode later. This meant that Pascal spread very quickly through the world's Universities. They soon began teaching in Pascal -- it was a very good language for demonstrating structured programming, a hot topic at the time. | ||
30 | |||
31 | Standard Pascal was a nice language with terrible limitations: Pascal programs could not open files by name, could barely handle strings and could only pass arrays of predetermined sizes to functions. BrianKernighan famously described Pascal's problems in [Why Pascal is Not My Favorite Programming Language |http://www.lysator.liu.se/c/bwk-on-pascal.html]. (It has to be noted that NicolasWirth had already addressed most of Pascal's problems in his follow-up language [Modula2] ''before'' Kernighan wrote this paper, and in some places Kernighan seems to be just complaining that Pascal is not [C].) At any rate, these limitations meant that Pascal splintered into dialects as people hacked in missing features in incompatible ways. [C] did not have this problem, so it gradually took over from the Pascal dialects. | ||
32 | |||
33 | !!! Implementations | ||
34 | |||
35 | The most successful Pascal dialect has been Borland's TurboPascal. There are two OpenSource Pascal compilers for [Linux]: | ||
36 | |||
37 | * [GNU Pascal | http://www.gnu-pascal.de/] | ||
21 | LawrenceDoliveiro | 38 | * [Free Pascal | http://www.freepascal.org/]. __Note__ this is written in Pascal, so you need an existing Free Pascal binary to build the source! |
15 | AristotlePagaltzis | 39 | |
40 | Free Pascal tends more towards TurboPascal compatibility. | ||
41 | |||
42 | The online book [Pascal Implementation: A Book and Sources | http://www.cwi.nl/~steven/pascal/] walks you through the source code to the original Pascal compiler (implemented in Pascal as a RecursiveDescentParser). It's educational to read just as an extended critique of a non-trivial program. | ||
43 | |||
44 | ----- | ||
45 | Part of CategoryProgrammingLanguages, CategoryImperativeProgrammingLanguages, CategoryMachineOrientedProgrammingLanguages |
lib/blame.php:177: Warning: Invalid argument supplied for foreach() (...repeated 7 times)