At this stage of compiler writing, we will discard some aspects of Pascal to make our jobs easier. While these eliminations significantly simplify your job, they should not significantly reduce your learning, as the main learning at the type checking and translation stages comes from getting the basic compiler working. In addition, this simplification will give you greater opportunity to experiment with code optimization.
Our main changes are to the types you need to support, to the forms of functions and procedures you need to support, and to awkward control structures. If you find that there are other simplifications that will be helpful and seem reasonable, please discuss them with me.
We begin by eliminating most complex types.
You need only deal with the basic types
string, as well as one-dimensional
arrays indexed by integers.
While we will discuss (in
the abstract) type checking and translation of pointers, records, variant
records, multi-dimensional arrays, and user-defined types, you will not be
required to type check or implement those types. You also will not be
required to type check or implement sets, files, and packed types.
Because we are eliminating records, you need not deal with
Because we do not permit user-defined types, you can assume that
case statements and
for loops are
indexed by integers.
You need only support integers, reals, and Booleans as parameters to functions and procedures. You need not support arrays, strings, functions, or procedures as parameters to functions and procedures. (Since we have already disallowed records and user-defined types, you should not expect to support those types.)
You need only support value parameters. You need not support variable parameters.
You need suport neither labels nor the
Thursday, 1 April 2004 [Samuel A. Rebelsky]
Monday, 5 April 2004 [Samuel A. Rebelsky]
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 Mon Apr 26 13:19:33 2004.
The source to the document was last modified on Mon Apr 5 11:29:05 2004.
This document may be found at