Compilers (CS362 2002F)

Project, Phase 4: Translation to PAL

Assigned: Wednesday, November 20, 2002
Due: Friday, December 13, 2002

Summary: In this stage of the project, you will translate your parse trees into a simple intermediate code, PAL.

Group Work:

Core Assignment

Write a translator that traverses parse trees for a selected subset of Pascal programs and translates them to PAL. You should then print out the corresoponding PAL program (preferably to a file) and run it.

Your translator need only deal with integer and Boolean types (and you can treat Booleans as integers). You need to handle conditionals, assignment (with all types of expressions except record and arrays), procedure calls, function calls, while loops, repeat loops, and for loops.

You need not handle case statement, array indexing, records, labels and gotos, pointers, variable parameters, or nested function or procedure definitions.

You can assume that the program is type correct and that all variables are declared.

You can use my implementation of symbol tables, which is available in /home/rebelsky/Web/Courses/CS362/2002F/Examples/rebelsky/compiler/misc/

You can find information on PAL in the lab on PAL.

Extra Credit

For extra credit, do more than the minimum.



Friday, 1 November 2002 [Samuel A. Rebelsky]

Friday, 8 November 2002 [Samuel A. Rebelsky]


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 Nov 20 11:06:53 2002.
The source to the document was last modified on Wed Nov 20 11:06:15 2002.
This document may be found at

You may wish to validate this document's HTML ; Valid CSS! ; Check with Bobby

Glimmer Labs: The Grinnell Laboratory for Interactive Multimedia Experimentation & Research