Skip to content

Assignment 2: Register allocation

Overview

In this assignment, you will be extending your Var language compiler from the last assignment to do register allocation in the back end instead of putting all variables on the stack.

Textbook coverage

This assignment is based on chapter 3 of Essentials of Compilation.

Due date

This assignment is due on Friday, October 25th at 6 PM.

Starting code base

The starting code base is the zipfile ch3.zip, which is posted on the course Canvas site. You should unzip this file in your Github repo, inside the src/ directory. It contains partial implementations of all the code for the assignment.

Inside the ch3 directory will be these subdirectories:

  • The tests/ subdirectory contains the same test programs as in the previous assignment.

  • The reference/ subdirectory contains the output from the instructor's version of the compiler. Note that there are many more files in this directory than in the previous assignment, for reasons which will be explained below.

  • The scripts/ subdirectory contains scripts for testing your code. These are mostly the same as in the last assignment, but there are a few additional features, described below.

README or README.md file

Create a README or README.md file in your ch3 directory, and in it, identify which person wrote which passes. (If both partners worked on a pass, indicate that too.) Also, if you used any late days on the assignment, indicate how many late days you used.

"Submitting" your assignment

The process for "submitting" the code is the same as in the previous assignment, except that the code is in the ch3 directory, of course.