Penguin

Differences between version 20 and revision by previous author of Pascal.

Other diffs: Previous Major Revision, Previous Revision, or view the Annotated Edit History

Newer page: version 20 Last edited on Wednesday, July 4, 2007 1:26:03 pm by GlynWebster Revert
Older page: version 18 Last edited on Monday, January 19, 2004 6:26:30 am by AristotlePagaltzis Revert
@@ -1,45 +1,45 @@
 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. 
  
 !!! A Sample 
  
- __ function__ plural (noun : __ string__ ) : __ string__ ;  
- { Returns the plural version of a noun. }  
- __ var__  
- i : integer;  
- __ begin__  
- __ case__ noun[[length(noun)] __ of__  
- 's': __ if__ noun[[length(noun)-1] = 'e' __ then__  
- plural := noun  
- __ else__  
- plural := noun + 'es';  
- 'y': __ begin__  
- delete(noun, length(noun), 1);  
- plural := noun + 'ies';  
- __ end__ ;  
- __ else__ plural := noun + 's';  
- __ end__ ;  
- __ end__ ; {plural} 
+<verbatim>  
+ function plural (noun : string) : string;  
+ { Returns the plural version of a noun. }  
+var  
+ i : integer;  
+begin  
+ case noun[[length(noun)] of  
+ 's': if noun[[length(noun)-1] = 'e' then  
+ plural := noun  
+ else  
+ plural := noun + 'es';  
+ 'y': begin  
+ delete(noun, length(noun), 1);  
+ plural := noun + 'ies';  
+ end;  
+ else plural := noun + 's';  
+ end;  
+end; {plural}  
+</verbatim>  
  
 (This is in the TurboPascal dialect of Pascal.) 
  
 !!! History 
  
-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 began teaching in Pascal, because it was a very good language to demonstrate structured programming in -- a new idea and as such a hot topic at the time. 
+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. 
  
-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'' BrianKernighan wrote this paper. In some places BrianKernighan 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. 
+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. 
  
 !!! Implementations 
-  
-The Pascal grammer has maps very nicely to a RecursiveDescentParser struture and for this reason in it the language of choice when writing a RecursiveDescentParser by hand.  
  
 The most successful Pascal dialect has been Borland's TurboPascal. There are two OpenSource Pascal compilers for [Linux]: 
  
 * [GNU Pascal | http://www.gnu-pascal.de/] 
 * [Free Pascal | http://www.freepascal.org/] 
  
 Free Pascal tends more towards TurboPascal compatibility. 
  
-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. It's educational to read just as an extended critique of a non-trivial program. 
+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. 
  
 ----- 
 Part of CategoryProgrammingLanguages, CategoryImperativeProgrammingLanguages, CategoryMachineOrientedProgrammingLanguages