University of Arizona, Department of Computer Science

CSc 453 : Programming Assignment 4 (Code Generation)

Start Date: Mon Oct 29, 2012

Due Date: 11:59 PM, Sun Nov. 18, 2012

1. General

This assignment involves generating assembly code for C--. The generated code should adhere to the operational semantics of C--.

The Target Architecture

The target architecture for this assignment will be the MIPS R2000 processor. Your compiler will generate assembly code for this processor; this assembly code will be executed using the SPIM simulator. (The code is free: it is available on lectura, and executables for PCs running MS-DOS and Microsoft Windows, together with documentation, are available from the SPIM homepage. However, note that SPIM inherits the endian-ness of the underlying processor, and this can cause it to give different results for the same program on different machines.)

Output Operations

These will be implemented using functions print_int() and print_string, as for Milestone 1.

Supporting Documents

The following documents may be useful for this assignment:

2. Output

As before, your program will take its input from stdin and generate all output on stdout. Error messages, if any, will be sent to stderr. In case any errors are encountered during lexical or syntax analysis or during type checking, you should stop generating code, but continue to process the user program as best as possible.

3. Turnin

You should turn in all the sources to all the phases of your compiler. You should also turn in a Makefile that supports at least the following:
make clean
remove all *.o files as well as the file compile from the current directory.
make compile :
Creates an executable file in the current directory called compile that implements your compiler. Note that this should build your compiler from scratch, i.e. starting from the lex specification.
To turn in your program, execute the command turnin   cs453f12-assg4   files.

4. Milestones

There is one intermediate milestone for this assignment, the spec for this is available here.