CS 4980 CC: Assignment 4: Intermediate Representation

The goal of this assignment is to give you experience generating intermediate representation from code. You will work in teams of two or three students for this.

A starting point for this assignment is in the IntelliJ project, as4irgen.zip. The solution should unpack and build with no errors, at least when using JDK 8. (It will likely build and run with other versions as well, but esubmit uses JDK 8.) To run, ensure the Project Structure includes the appropriate version of JDK and then add a start configuration:

Your edits will be in the file ToTree.java. See the TODO statements in this file. You can change other files in the top directory as well (Frame.java, MIPSFrame.java, ToTreeList.java, X86Frame.java), but it is unlikely you will need to make modifications to these files. Note that sablecc.jar has already been run on the grammar file and that your main is already set up to build the symbol table and typecheck the program.

Some additional notes on the files you have been given:

Clarifications

Sample Run

Not all tests will have sample output because the primary goal of the assignment is to determine what output to produce. It is also not clear that every correct solution will produce the same output. The instructor's solution produces factorial-output.txt for the input fact.mj.

Groups of 3

Groups of 3 will have additional requirements. These requirements will not be tested by esubmit, so we may use demos to confirm them.

Submission

Make sure all group members are documented at the top of ToTree.java. Submit your solution to esubmit as as4ir. At a minimum, submit ToTree.java as the main and ToTreeList.java as an additional file. Include any other files you write or modify, but most solutions will not need additional files. Do not submit mjava.grammar; talk to your instructor if you needed to modify the grammar file for your solution.

Since this is a group assignment, your instructor needs to know which esubmit solution to grade. After your final submission, take a screen shot showing the top part of the submission (with the assignment name, the name of the user doing the submitting, the date, and the number of differences) and submit that screen shot to Canvas.