Assignment 4: Closure Conversion

Due date: 21st April, 2016, 13:00

   (graded, group assignment)

Your task in this assignment is to complete the CPS value representation phase by implementing closure conversion (CPSValueRepresenter.scala). Additionally, you are also required to implement the hoisting phase that brings all function bodies to the top level (CPSHoister.scala).

You can choose to either implement the “simple” or the optimized version of closure conversion. Correctly implementing the simplified one will give you 80% of the grade for this assignment, while a correct implementation of the optimized transformation will give you 100% of the grade.

Notice however that by submitting an incorrect version of the optimized transformation you may loose a lot of points depending on the mistakes. Therefore, we recommend that you start by implementing the basic closure conversion procedure and, if you are successful and still have time, to extend it to the optimized procedure.

In the new `Assignment4` branch you will find the necessary templates for this assignmentYou can use the helper methods in the  l3/package.scala file. Like in the previous assignments, you will have to merge the skeleton for assignment 4 with the changes you made for assignment 3. To do so, use: 

 git commit -a git fetch git merge origin/Assignment4 //resolve merge conflicts cd compiler sbt clean update compile test

Note that the signature for transform function now has an extra argument.

Please make sure to indicate in git commit message which version of closure converion you are implementing.

You should be able to do this without merge conflicts or compilation errors. If you get into trouble with git, ask the TAs. We do not provide any additional testcases for this assignment.