University of Arizona, Department of Computer Science

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

Start Date: Tue Nov 3, 2015

Due Date: 11:59 PM, Fri Nov. 13, 2015

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:

Note: Your compiler is not required to enforce the restrictions described above. These restrictions given simply specify the subset of the language you need to implement for this milestone. The test cases for this milestone will all meet these restrictions.

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.

The exit status of your program should be 0 if no errors are encountered during processing, and 1 if any errors are encountered at any point.

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 targets:

To turn in your program, execute the command turnin    cs453f15-assg4ms1   files.