Computer Science Department
Programming Methods Laboratory

Compilation     winter 99/00
Ecole Polytechnique Federale de Lausanne
Assignment 3
08.12.1999

This assignment consists of three subparts:
  • Write the remaining classes for the abstract syntax tree
  • Extend the parser to generate the abstract syntax tree
  • Write a pretty printer for the abstract syntax tree
For the classes of the abstract syntax tree a framework is provided on the WWW in the file Tree.java. If you have no position managment in your scanner/parser, you can use the new nextCh() routine from Scanner.java and also Position.java.

For extending the parser you will sometimes need arrays of subtrees. You can use TreeArrayBuffer.java for doing this.

There is also a framework for the pretty printer on the WWW: Printer.java. This pretty printer uses the concept of a visitor. You will need the pretty printer to check, whether you built a correct tree. It is not neccessary to print correct J0 and it does not matter if you have additional parentheses.

This assignment is valid only 5 points!

The assignment is due on Friday, 17.12.99.
Tutorial for Programming Language Implementation, 08.12.99