View the Project on GitHub TiarkRompf/cs502

Project 2: CL3 to CPS Translation

Due: Sept 11, 11:59PM

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

The skeleton code for the assignment is available here.

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, which you can compare with your own implementation from last week.

Also, you may notice that between translation and interpretation, there is an additional step called SymbolicCPSTreeChecker. The purpose of this module is to go through your generated CPS tree, check that all names used are defined exactly once, and emit useful warnings in case they are not. Take advantage of this output to track any bugs you may have in the translation. Notice that, since SymbolicCPSTreeChecker.apply returns Unit, we have to pass it to the passThrough function to integrate it in the pipeline.

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. Important: take the time to understand the helper methods that are provided, and use them as frequently as possible! It will save you time and help you avoid common errors.

Turning In

The project is due by September 11, 11:59PM. To turn in your project, go to the same directory that your proj2 directory lives in (you do not have to name it proj2, but it must contain all of the project files) and type:

turnin -c cs502 -p project2 proj2 

You can verify the status of your turned in project by running:

turnin -c cs502 -p project2 -v


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.