Assignment 3

In this assignment, you will add support for variables to the intermediate language.

In MemoryManagement.scala, complete the implementation of:

  1. variableToOffset in the Chunk class
  2. load and store in the Chunk class
  3. initialize in the Chunk class
  4. allocate in the Stack object
  5. pop in the Stack object

In Transformations.scala, complete the implementation of:

  1. eliminateVarAccessesA3
  2. allocateFrameOnStack

Read and understand the methods after allocateFrameOnStack up to compilerA3. Try compiling small programs with compilerA3 and running them.