University of Arizona, Department of Computer Science

CSc 453 : Programming Assignment 4 (Code Generation): Milestone 1

Start Date: Mon Oct. 29, 2012

Due Date: 11:59 PM, Wed Nov. 7, 2012

1. General

This milestone involves MIPS assembly code generation for the subset of C-- described below. The generated code should adhere to the operational semantics of C--.

1.1. Language Subset Considered

For this milestone, you need to handle C-- programs containing the following language features, but not features that are excluded in the list below:

1.2. The Target Architecture

The target architecture for this assignment will be the MIPS R2000 processor. The requirements in this regard are the same as for the overall Assignment 4.

1.3. I/O Operations

Test programs will use the following two functions to print out the results of computations:
extern void print_int(int x);
extern void print_string(char x[]);
For example, a program might look like this:
extern void print_int(int x);
extern void print_string(char x[]);

void main( void ) {
  print_int(12345); print_string("\n");
}
In addition to the assembly code generated for the program, you should generate the instruction sequence for the functions print_int() and print_string(), as described in the document Notes on Translating Three-Address Code to MIPS Assembly Code.

1.4. Testing Your Programs

You can obtain the "expected output" for your test cases by compiling them using gcc, with definitions for print_int() and print_string() supplied in a separate file and linked in in the obvious way.

1.5. Supporting Documents

Same as for the overall Assignment 4.

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-assg4ms1   files.