Computer Science Department
Programming Methods Laboratory

Compilation     winter 99/00
Ecole Polytechnique Federale de Lausanne
Assignment 5

In this assignment you have to finish your compiler by writing the code generation pass. Your compiler is supposed to generate Java classfiles. We provide a framework so that you don't have to deal with technical details concerning the classfile format:
  • is a helper class for code generation
  • is an interface defining all bytecode instructions of the Java Virtual Machine,
  • is used for creating class files,
  • implements the constant pool management used by the Classfile class,
  • supports the generation of Java bytecode,
  • implements the Item structure explained in the lecture,
  • defines a couple of primitive functions for every j0 program,
  • belongs to the j0 runtime and defines the predefined primitive functions,
  • defines the main method of the complete compiler.
For details please check the source code of the various framework classes. In order to integrate the framework into your own compiler, you have to update a couple of existing source files as well:
  • in you have to include the four lines tagged with new,
  • the variable errorLog in file has to have package visibility
  • the Symbol class now defines some new fields, so the file has to be updated
  • file needs an update as well; it defines a new function signature used by the code generator
Your main task is to complete the new visitor which implements the code generation pass.

The assignment is due on Friday, 11.02.00. Please remember that this assignment is combined with an oral exam. We will give you details about the oral exam in the next lecture.
Tutorial for Programming Language Implementation, 21.01.00