Assignment 2: CL3 to CPS Translation

Due date: 13th March, 2014

(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 merge origin/assignment2 # and merge any conflict 

You will notice that l3.Main from the new project doesn’t run the CL3Interpreter anymore but first runs the CPS translator 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 git push origin master 

Important notes: The git interface will only see the master branch for testing. Therefore, to run tests, you need to keep your work on master, whether or not you use branches for development. Also the git repository won’t allow you to force-push, therefore you can only roll back previous commits using git revert.

Testing

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. The tests that you write may also get you small bonuses while grading.

Reference tests will be available in the Repository application, so commit your changes often and use your tokens to test.

To test a commit. Go to the “Tests” tab. Select “Assignment-2” in the title bar. By default, the title bar will be set to “Assignment-1”. Select “run tests!” on your preferred commit. Look at the output of the test and not just the displayed message, to know the result of your test.

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!