Assignment 4

In this assignment, you will add support for temporary variables, arithmetic operations, if statements and while loops, and pointer dereference operations to the intermediate language. You will then write some programs that use these features.

In CodeBuilders.scala, complete the implementation of binOp and the codes for the arithmetic operations after binOp.

In Transformations.scala, complete the implementation of:

  1. eliminateTempVars
  2. eliminateIfStmts

Back in CodeBuilders.scala, complete the implementation of the comparison operators.

Still in CodeBuilders.scala, implement:

  1. deref
  2. assignToAddr

In A4.scala, complete the implementation of lastElement.

Back in CodeBuilders.scala, complete the implementation of whileLoop.

Back in A4.scala, complete the implementation of:

  1. arrayMaximum
  2. outputLetters
  3. printIntegerVariables
  4. printIntegerCode