On this page:
3.2.1 Assignment Summary
3.2.1.1 Checklist
3.2.2 Reading
3.2.3 Assignment
3.2.4 Validators and interpreters
8.10

3.2 Iteration 1: Towards a Declarative Language

3.2.1 Assignment Summary

The goal of this assignment is to introduce the process of designing, implementing, and reasoning about a compiler. In particular, we look at designing languages by abstracting away from annoying details, and implementing those abstractions by compilation.

In this assignment, you will implement a small abstraction layer on top of x64, called Paren-x64 v2, which allows easily writing a subset of x64 programs while ignoring some of the boilerplate and operating-system-specific details.

Then, we will abstract away from imperative instructions on locations to expressions on values, and abstract away from a small number of physical locations and replace them with an essentially unboundedly large number of abstract names.

Unit test appropriately, with tests for both failure and success for each compiler pass. You should look into the RackUnit: Unit Testing package. There should be a test module for each of the compiler passes next to the implementation of the pass. You can also test the whole compiler pipeline in the compiler.rkt file.

You can use the interrogator to get limited access to the reference solution: https://soft.vub.ac.be/compilers/interrogator?an=a1 and https://soft.vub.ac.be/compilers/interrogator?an=a2.

You can use the language diff tool to view differences between languages that aren’t typeset in the book: https://soft.vub.ac.be/compilers/differ.

3.2.1.1 Checklist

Provided passes

Completely new passes

Minor modifications

    Remove passes

      3.2.2 Reading

      The reading for this iteration is A Compiler Begins with a Language, Abstracting Boilerplate (v1). Abstract Locations and Value Orientation.

      This description links to the documentation for each exercise in the chapter for convenience, but you are responsible for the reading the entire chapter.

      You should read first and work the relevant exercises as you read.

      3.2.3 Assignment

      Implement the following compiler passes

      Here are some useful notes:

      3.2.4 Validators and interpreters

      In these exercises you extend the well-formedness checkers and the interpreters for the source and target language. Generic definitions are given for these by default which you have to replace with your own implementations. You should however prioritize the assignments above, which do not have default implementation and are therefore more important for obtaining a fully functioning compiler pipeline.