CSCI 310 Project 6

The last task of the semester is to generate IRTs from your code.

The process goes in two phases. The first establishes frame information, the second builds statement trees for each method in the code.

Building frame info

Cass Decls

The visitor

Method Decls

The visitor Note 1: One way to approach this is to start with the symbol table and replace/update the entries for classes, methods, variables with the information you are gathering here -- since your symbol table lookup will find the correct binding for each identifier, this guarantees your IRT generation will then find the correct pieces.

Note 2: Mips/MipsFrame.java is supplied (has permanent registers allocated, as are the Temp and Label generators.

Generating the IRTs for each method

In the Second pass (another visitor):

Each expression causes an IRT to be generated. Identifiers will have had IRTs desribing their use/access generated in the first pass, so this is really just a matter of gluing that tree into the tree you create for the expression.

Statements similarly build IRTs.

Method bodies can be treated as statements. Build the tree describing the statements, then add a statement moving the return value into the RV register. (Don't forget to start the whole thing with the appropriate label generated during the first pass.) A pair consisting of the method's frame and this statement tree is then added to a global ProcedureFragment list (an arraylist). This list is the ultimate product of the IRT process.

(Recall that we discussed all the statements and what their IRTs look like, so this part is a matter of using the Tree creatures appropriately.

What's Given

p6.tar contains