Assignment 2, csc431, Fall 2019
1 Goal
Develop a compiler for a simple language with two operations and variable bindings.
2 Input Language
Your input language should be the s-expression-based R1 language of Siek & Newton.
3 Output Language
Your output language should be x86_64 assembly using the Intel assembly style, suitable for compilation by nasm.
4 Implementation strategy
You should compile your source into assembly by implementing the compiler stages of chapter 2. Simple!
Specifically, your compiler should include representations for the R1, C0, and x86_0 languages, as shown in figure 2.8. It should be able to stop after any of the steps in compilation, and write the result to a file.
5 Running it
Let’s give our project a name. It will be called... blungentle. Why not?
It should be possible to run your compiler using a blungentle binary or shell script.
For now, let’s keep it simple, and insist on accepting the name of an input file and an output file:
blungentle <opt-flags> <input> <output> |
If no flag is specified, the result should be an assembly file compilable with nasm. If "-r" is specified, it should be a file containing an s-expression representing the result of the compilation after the "remove-complex-opera*" pass (that is, the last "R" pass). If "-c" is specified, the file should contain the result of the last "c" level pass, "uncover-locals".
You’re welcome to add additional flags to represent the output of other passes, if you like.
6 Testing
You need to have some kind of testing framework, both for unit tests and for integration tests. That is, you should be able to start a test run and receive a complete report on which tests succeeded and failed.
7 Demo
Your team will need to demo this project during lab on October 7.
8 Submission
You’ll also need to submit the project, by pushing it to a github repository.
9 Test cases
10 Scoring
The functionality will be broken into tiers, as follows:
(4 pts) simple numbers
(4 pts) simple operators
(2 pts) nested arithmetic operators
(2 pts) (read)
(1 pt) nested arithmetic operators + (read)
(2 pts) let + nested arithmetic operators
(1 pt) let + nested arithmetic operators + (read)