CS 453 Programming Assignment #6 — MeggyJava local and member variables and assignmwent
Due Tuesday May 1st (by 11:59pm)
Introduction
This assignment is to be done with your CS 453 programming partner.
In this assignment you will be writing a compiler for the
PA6
subset of the MeggyJava language that includes local and member
variable declarations and assignment statements.
The main addition in terms of
functionality will be handling of classes, local and member variables,
the equality operator for integers and references, and the
less than operator for integers.
Variable declarations of type button, and hence assignments to button
variables, are not supported in MeggyJava.
You will
- add the PA6 grammar rules to the parser,
- and update the visitors to handle the new language
features.
You will need to extend the type checking for objects and (instance and local) variables.
Here are some example programs:
PA6loc.java, its symbol table, and
its PA6loc.java.s file,
PA6obj.java, its symbol table, and
its PA6obj.java.s file.
The Assignment
The Makefile creates a jar file, MJ.jar, that can be executed as follows:
java -jar MJ.jar InputFile.java
The input files can be any PA6 MeggyJava program. Start with the above simple examples.
Ultimately, the PA6Cylon.java example you wrote for PA1 and
PA6PaddleBall.java are possible test cases for MJPA6_groupname.jar.
The output file named InputFile.java.s should be an AVR assembly program that using
the
provided build process will run on the MeggyJr device.
Additionally, the InputFile.java.s file must be such that we can run
it through the AVR simulator.
Errors found while type checking and building the symbol table
Your compiler should produce error messages for doubly defined symbols, e.g.
for PA6dupnameserror.java:
[23,16] Redefined symbol A
[27,17] Redefined symbol run
[40,16] Redefined symbol B
[45,17] Redefined symbol foo
[51,21] Redefined symbol run
[57,7] Redefined symbol A
Errors found while building symbol table
Code Generation
Your allocVars visitor now annotates the instance and local variables
in the symbol table with offset and base information.
This information is used by the
AVR code generator to handle the new language features.
See the Meggy Sim instructions for usage notes.
For more details about the instructions see
the 08-MeggyJrSimple-n-AVR.txt notes.
Design, implement, and test the symbol table and related classes step wise..
Submitting the Assignment
Late Policy
Late assignments will be accepted up to 48 hours past the due date for a 10%
deduction. The assignment will not be accepted past this period.
Late means anything after 11:59pm
on the day the assignment is due, including 12 midnight.