COS 320, Spring 2000. Programming Assignment

Programming Assignment 6: Translation to Intermediate Representation

Note: For this project, you must run sml and gcc on the sparc machines such as arizona.  This isn't as bad as it sounds. Map your OIT account space as a drive on your home computer (see You can now edit OIT files on your home computer as if they were local.


1) Copy /u/cos320/chap6/* into a new directory as6.

2) Untar CM.tar into the directory as6.

3) Copy your working tiger.lex and tiger.grm from assignment 4. If you don't have working versions, then don't copy them! CM will automatically use versions that are provided.  You now have two choices:

a) Use the supplied semant.sml.

b) Edit your working semant.sml to make the proper calls to the translation skeleton. This will be more work of course, but may be more rewarding.


The objective of this assignment is to fill in the "(*!!FILL IN HERE!!*)" holes in translate.sml.  Note that the comments on each function occasionally include hints to guide you. Understand the existing code before you start to edit the file.


To view the generated IR, run Test.translate "filename";

To test the generated IR:

1) Run Main.compile "filename.tig"; This will generate a "filename.tig.s" assembly file.

2) Run "gcc runtime.c filename.tig.s" on arizona; This will generate an "a.out" binary file.

3) Run the a.out binary file.


You must submit the file "translate.sml."  Please test your code with at least queens.tig, merge.tig, and merge-sort.tig.