Assignment 2: CL3 to CPS Translation

(graded, group assignment)

In this first graded assignment, we are asking you to implement the optimized CPS transformations you have seen in the course.

The source code that enables you to start working on this assignment is already available in the git repository. Just do:

 git commit -a # commit anything you still have for assignment1 git fetch # get all changes from the remote repository git checkout assignment2   

You will notice that l3.Main from the new project doesn’t run the CL3Interpreter anymore but first runs the CPS transformator and then an interpreter for your CPS representation. The new source files also contain a complete L3Parser class with correct syntactic sugar conversions as well as int-print in the l3 library, which you can compare with your own implementation from last week.

You will find that methods nonTail, tail and cond in l3.CL3ToCPSTranslator directly correspond to translations that were explained during the lecture. Transformation for let is already given to you as an example. Your task is to complete these methods by adding the missing cases. (Hint: for some cases, you might want to reuse the existing helper method nonTail_*)

When you are done editing, the commands to submit the source files are: 

 git add ... # files modified, as shown by "git status" git commit -m "Your message here" git push origin assignment2 # or git push, which will push all branches


In order to quickly test your implementation, we included two new example applications in the examples directory and the infrastructure for testing the CL3 to CPS transformation. Unlike for the previous assignment, very few test cases are given to you. You should fill in the tests, as they guide you through the implementation and may get you small bonuses in case you make mistakes in the implementation.

Reference tests will be available in the Repository application, so commit your changes often, “Mark as deliverable” to and “Schedule tests”. The tests for the graded assignments are hidden and are only meant as guidance on whether everything worked well on compiling and executing the assignment. The grade will still be given manually, based on the correctness of your implementation, so you may end up with an assignment that passes all tests graded at 70 points (of 100) for not treating important corner cases. On the contratry, you may also find an implementation that fails a few tests because it took a slightly different translation graded at 100 points, as the alternative translation was correct. So do your best to have a correct implementation and think about all corner cases!