Develop a compiler for a simple language with two operations and variable bindings.
Your input language should be the s-expression-based R1 language of Siek & Newton.
Your output language should be x86_64 assembly using the Intel assembly style, suitable for compilation by nasm.
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.
Let’s give our project a name. It will be called... sepaine. Why not?
It should be possible to run your compiler using a sepaine binary or shell script.
For now, let’s keep it simple, and insist on accepting the name of an input file, a number of passes, and an output file:
sepaine <input> <# of passes> <output>
The number of passes can be zero, indicating that the output will be exactly the same as the input, or 8, indicating that the output should be compiled all the way to x86_64 assembly.
Your team will need to demo this project during lab on April 19th.
You’ll also need to submit the project, by pushing it to a github repository.
Here’s a compressed bundle of test files, along with the code that generated them.
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)