CSc 453 : Programming Assignment 4 (Code Generation): Milestone 1
Start Date: Mon March 23, 2016
Due Date: 11:59 PM, Tue April 5, 2016
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 the
nano-C subset of μC.
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 function to print out the results
of computations:
extern void println(int x);
The behavior of a procedure call println(e)
in μC is similar to that of printf("%d\n",e)
in C.
For example, a program might look like this:
extern void println(int x);
void main( void ) {
println(12345);
}
In addition to the assembly code generated for the program, your compiler
should generate the instruction sequence for the println() function
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 a definition for println()
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:
-
compile
The command "make compile" should build
your compiler from scratch, by invoking
the appropriate tools (flex, bison, etc.)
on their input specifications, and should result in the creation of an
executable file compile that implements the functionality
specified above for this assignment.
-
clean
The command "make clean" should delete
(at least) all software-generated files in the current directory,
including: C source files created by flex/bison,
e.g., y.tab.h, lex.yy.c, y.output,
etc.; object files, *.o; as well as the executable file
compile.
To turn in your program, execute the command
turnin cs453s16-assg4ms1 files.