Assignment 5: Translation to IR

Due: 10:00 pm, Wednesday, November 10.

Finally we start actually compiling!

Project 5 is to read chapter seven of the text and build a module to translate Tiger ASTs to an IR tree.

In the last two projects, the Translate module has gone from an empty stub to a small collection of frame-manipulation utilities. Now we finally flesh it out to do real translation.

You will need to augment existing structures as described in chapter 7. You may define the Frame.procEntryExit1 function as a stub (we'll come back to it at a later date). Make sure you use it, however, in your translation code.

The definition of the TRANSLATE interface is part of this project; define it with your teammate(s). You may discuss it outside your team in general terms, but no code on piazza, please.

Your Semant module should export a transProg function which is the ultimate AST->IR interface for the whole post-parser ensemble of modules we have constructed up to this point.

You are required to handle evaluation-for-control (Cx expressions) in a reasonably sophisticated manner. For example,

if a < 0 or x > y
then …
else …

should translate into a reasonable tree of conditional tests and branches. This may require some thought.

You should submit

The bad news: Students tell me this is the most programming-intensive phase of the compiler. The good news: I predict you will find this part of the compiler the most fun yet.

  –Olin

CS4410