CS590

View the Project on GitHub TiarkRompf/cs590

Metaprogramming and Program Generation

One person's program is another program's data.

Tiark Rompf, Fall 2014, 3 credits

Assignment 2

Reading

Read the following two papers and write a short summary (0.5 pages for each):

Your summary should identify the main insights and scientific contribution of the paper: what is the key idea? what is possible after the paper came out that wasn't possible before? (It is a good idea to skim some of the related work to answer these questions).

Here is some additional advice, by Kathryn S McKinley (thanks to Keith Chapman for the link).

Summaries are due before midnight on Thursday, September 18 (submit per email to the instructor).

Hacking

Clone the course repo from GitHub. Solutions are due before midnight on Thursday, September 18Saturday, September 20 (submit per email to the instructor).

An Image DSL that Compiles to JavaScript

This assignment will implement an embedded image DSL, similar to the one in Elliot's paper in Scala. DSL programs will be compiled to JavaScript.

A. Drawing a Checker Board

Familiarize yourself with the test case "allred" to understand how the compilation works. Then fill in test "checkers" to draw a checkerboard. You may need to extend trait Images along the lines of the paper.

B. Transformations

Implement translate,scale,rotate and draw images that use these transforms. Use the Pan image gallery or the paper for inspiration.

C. Static Types and Smart Constructors

Take trait ImagesPoly as a starting point to implement the typed representation described in Section 5. Implement the algebraic optimizations using smart constructors described in Section 6.

D. Bonus: CSE

Implement the common subexpression elimination optimization described in the paper.