Pascal

advertisement
Ryan Piercy
Jon Hooker
 Invented by Nicklaus Wirth
 Named After Blaise Pascal
 Pascal’s Triangle
 Invented a Digital Computer
 Why?
 No Structured Languages
 Expensive Compilers
 Make Programming Accessible
 Popular at Universities
 Educational Testing Service
 Standard on AP Tests until 1999
 Borland Releases Turbo Pascal
 Lightning Fast
 Thousands of Lines per Minute
 Object Pascal/Delphi
 Strongly Typed
 Strict Compiler
 Good for Beginners – Specific Error Messages
 integer
 real
 char
 Boolean
 Subranges/One-Dimensional Arrays
 intarray = array[1..10] of integer
 Multi-Dimensional Arrays
 Declaration:
 datatype = array[enum1, enum2, etc.]
 Use:
 datatype[1, 2]
 Record
 type
InfoType = record
Name : string;
Age : integer;
City, State : String;
Zip : integer;
end;
 Uses Dot Operator
 recordtype.fieldname
 Also Can Access Multiple Fields
 with recordtype do
 Begin
 field := value
 field2 := value
 End;
 Allocate Memory: New (PointerVariable)
 Linked List Using Record/Pointers
 type
PointerType = ^RecordType;
RecordType = record
data : integer;
next : PointerType;
end;
 Pros
 Syntactically similar to C and ALGOL, upon which
Pascal is based
 Data is strongly typed and declared
 Good balance of orthogonality (few methods of
accomplishing similar tasks)
 Recognizable statement structure and keywords
(loops, if, while, etc.)
 Relatively simple, good for structured learning of other
languages
 Cons
 Semicolons separate statements instead of
terminating them
 Extensive nested procedures are allowed
 Identifiers are not case-sensitive:
 MyLabel vs. mylabel vs. mYlAbeL
 Pros
 Purely procedural, but other derivations are designed
for other paradigms (object-oriented)
 Function vs. Procedure: functions return values,
procedures do not
 Blocks are denoted using keywords begin and end
 Cons
 Semicolon placement can be confusing
 Treatment of arrays: array size is part of the type at
declaration, making it impossible to define utility
functions/procedures that utilize arrays of any datadependent length, a severe limitation, especially in
handling strings
 Pros
 Provides run-time type checking, including
bounds checking on arrays
 Strongly typed variables
 Allows pointers, but with limitations (can only
reference dynamic variables, must have an
associated type, etc.)
 Good exception handling
 Cons
 None
 Used for Education
 Needs to be Safe and Reliable
 Pros
 Familiar and recognizable C-like syntax
 Easy to learn, so training is cheap
 Several compilers and interpreters are available to the
public for free
 Delphi, Free Pascal, Lazarus, and Turbo Pascal are
examples
 Easy to maintain/update due to high readability
and ease of understanding
 Cons
 Many variations to incorporate different paradigms
(object-oriented)
 Scientific Instrumentation
Companies
 Database Administrators
 Beginning Programming Courses
 Nostalgia Buffs
 Java Job Listings
 Pascal Job Listings

http://www.doc.ic.ac.uk/~nd/surprise_96/journal/vol2/mk8/article2.html#P

http://en.wikipedia.org/wiki/Pascal_(programming_language)

http://en.wikipedia.org/wiki/Comparison_of_Pascal_and_C#Functions.2Fprocedures

http://www.freepascal.org/docs-html/ref/ref.html

http://taoyue.com/tutorials/pascal/history.html

Nance, Douglas W. (1998). Fundamentals of Pascal. Cincinnati: South-Western Ed. Pub.
Download