|
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:
- ByteArray.java is a helper class for
code generation
- Bytecodes.java is an interface defining all
bytecode instructions of the Java Virtual Machine,
- ClassFile.java is used for creating class
files,
- Pool.java implements the constant pool management
used by the Classfile class,
- Code.java supports the generation of Java bytecode,
- Item.java implements the Item structure explained
in the lecture,
- Predef.java defines a couple of primitive functions
for every j0 program,
- Runtime.java belongs to the j0 runtime and defines
the predefined primitive functions,
- Main.java 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 Analyzer.java you have to include
the four lines tagged with new,
- the variable errorLog in file Report.java
has to have package visibility
- the Symbol class now defines some new fields, so the file
Symbol.java has to be updated
- file Type.java 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
Generator.java which implements the code
generation pass.
|
|