Skip to content

Assignment 3: Testing the compiler

Compiling and running the compiler

To compile the compiler, cd into the src/ch4 directory and type make. This will compile the compiler (which is an executable file called compile). You should see a number of warnings when you compile the compiler; that's expected. (As you fill in the code for the compiler passes, these warnings will go away).

The command-line interface to the compile program is identical to that of the previous assignment, except that there are three new passes:

  • "shrink" (abbreviated sh)
  • "remove unused blocks" (abbreviated ru)
  • "remove jumps" (abbreviated rj)

Testing your compiler: the test scripts

The test scripts are essentially unchanged from the last assignment, except for those changes that had to be made to accommodate the new compiler passes.