Assignment 1, csc431, Spring 2019
1 Goal
2 Input Language
3 Output Language
4 Implementation strategy
5 Running it
6 Demo
7 Submission
8 Test cases
9 Scoring
7.3.0.3

Assignment 1, csc431, Spring 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... 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.

6 Demo

Your team will need to demo this project during lab on April 19th.

7 Submission

You’ll also need to submit the project, by pushing it to a github repository.

8 Test cases

Here’s a compressed bundle of test files, along with the code that generated them.

9 Scoring

The functionality will be broken into tiers, as follows:

  1. (4 pts) simple numbers

  2. (4 pts) simple operators

  3. (2 pts) nested arithmetic operators

  4. (2 pts) (read)

  5. (1 pt) nested arithmetic operators + (read)

  6. (2 pts) let + nested arithmetic operators

  7. (1 pt) let + nested arithmetic operators + (read)