Computer Science Department
Programming Methods Laboratory

Compilation     winter 00/01
Ecole Polytechnique Federale de Lausanne
Assignment 3
01.12.2K

This assignment consists of three subparts:
  • implement all abstract syntax tree classes,
  • extend the parser to generate abstract syntax trees, and
  • write a pretty printer for abstract syntax trees.
For the classes of the abstract syntax tree a framework is provided on the WWW in the file Tree.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: 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 give out correct J0 and it does not matter if you have additional parentheses.


You should present your solution in the tutorial on Friday, 15.12.2K.