Abstract:
You will complete your code generator for a subset of Java.
In this lab, you are given a
class solution for homework 5; if you wish to use
your own solution, that's fine; let me know if I can help you set this up.
Be certain to modify only the file CodeGenVisitor.java.
Your assignment must generate object code for the
constructs found in the test files:
expressions, assignment statements, if, while, return,
short-circuiting and, short-circuiting or, and, or.
One issue you will have to confront is how to handle Boolean-valued
expressions. The Java interperter does not have a built-in notion of
what a Boolean value is nor how it should be represented.
Extra credit is available, and can be applied to exams or quizzes.
A topic list appears below; before you begin on extra credit, please
consult with the instructor so the scope of the work is agreed upon in
advance.
Pre/post increment/decrement
Floating point primitive types
Semantic analysis: widening
Semantic analysis: coercion to general type
Compile == and != into .equals method calls
Arrays
Extendable primitive types
Checking for assignment to "this" -- it's illegal
Processing of field declarations -- the .field directive for Jasmin
Processing of constructors
Accurate declaration for .locals
Emitting "short" forms for iload and aload, so that they take
Handling "new" and constructor calls
one byte instead of two. For example, iload_1 instead of iload 1.