[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[Instructions]
[Links]
[Search]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Project]
[Readings]
[Reference]
Misc:
[2001S]
[2002F]
[SamR]
Back to A Quick Introduction to Pascal (1). On to The Source and Target Languages.
Held: Monday, 26 January 2004
Summary: Today we begin our study of Pascal, the source language for our compiler.
Notes:
Overview:
bigprogramming languages:
program name(ports); const constant declarations type type declarations var variable declarations procedure and function definitions begin sequence of statements separated by semicolons end .
var
keyword, you write variables names (separated by commas), a colon, and a type. For exmaple
var x, y: integer; z: real;
integer
, real
, and Boolean
.
array[lowest-index..highest-index] of type
records(something like classes, but without the procedures) with
record variable-declarations end
type weekdays = (Monday, Tuesday, Wednesday, Thursday, Friday);
:=
operation. For example,
x := x+1;
read
and readln
.
read(x); readln(x);
ln
indicates that the end-of-line character should be read.
write
and writelin
.
ln
indiates that the end-of-line character should be printed.
begin
and end
.
if test then statement
if test then statement else statement
case exp of val1: statement1 val2: statement2 ... valn: statementn end
default
or else
case.
Back to A Quick Introduction to Pascal (1). On to The Source and Target Languages.
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[Instructions]
[Links]
[Search]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Project]
[Readings]
[Reference]
Misc:
[2001S]
[2002F]
[SamR]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Wed May 5 11:46:55 2004.
The source to the document was last modified on Tue Jan 20 23:06:45 2004.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS362/2004S/Outlines/outline.03.html
.
You may wish to
validate this document's HTML
;
;
Check with Bobby