CSc 453 : Programming Assignment 4 (Code Generation)
Start Date: Mon April 11, 2016
Due Date: 11:59 PM, Tue April 26, 2016
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 the function println()
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.
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-assg4
file1
file2
...
filen
Turn in the files you want to submit just as they are: don't zip them up
or turn in a directory containing your files.
4. Milestones
There is one intermediate milestone for this assignment, the spec for this
is available here.