CS590

View the Project on GitHub TiarkRompf/cs590

Metaprogramming and Program Generation

One person's program is another program's data.
 – Olivier Danvy

Tiark Rompf, Fall 2014, 3 credits

Meetings are Monday, 12:30pm to 1:20pm LWSN 3162, and Wednesday, 10:30am to 12:10pm LWSN 3162.

Check back here regularly for updates (pro tip: watch the source repository on GitHub to be notified of any changes)

About the Course

Metaprogramming is the art of writing computer programs that write or manipulate other programs (or possibly themselves) as data. Common examples include interpreters, compilers, program analyzers, program generators and program transformers.

Why is metaprogramming useful? Just as programming is about automating tedious or repetitive tasks, metaprogramming is about automating tedious or repetitive programming tasks. A key use is making high-level programs run fast, by automating otherwise tedious program optimizations - either through an optimizing compiler or by making the program itself generate efficient low-level code.

In this course, we will look at common uses of metaprogramming, study metaprogramming patterns, and do some practical metaprogramming in Scala.

The course will be research oriented: there will be no lectures. Instead, we will read and discuss original research papers. There will be some older papers for context and some brand new ones from the forefront of metaprogramming research.

The course will be hands-on: programming is fun, so why just read and talk about it? We will have small weekly programming assignments during the first half of the course, and participants will pick a course project for the second half.

The Fineprint

Every week we will have 1 or 2 papers on a common topic and a small related programming assignment. All participants read the papers, write a short (0.5 page) summary, and solve the programming assignment. Then we meet and discuss the papers and the solutions to the assignment.

By mid-term, you will propose a course project, which is ideally related to your other research interests. For example, if you’re into image processing, a cool project would be a program generator for image processing kernels. Projects can be done in groups of two, and include a final presentation and a short report (+/- 4 pages).

Grading will be 25% participation in class, 25% paper summaries, 25% programming assignments, 25% course project.

Prerequisites: curiosity! Some experience with programming languages, interpreters, compilers etc is a plus.

Completed Student Projects

LMS-Truffle (Roman Tsegelskyi)
Combining staging with Self-Optimizing AST interpretation
Project on GitHub, slides (pdf), report (pdf)

WMMSim (Gowtham Kaki)
A Solver-Aided Weak Memory Model Simulator
Project on GitHub, slides (pdf), report (pdf)

Schedule

Date

Topic

Papers/Assignment

08/25

Intro

--

09/01

Interpreters and meta-circularity

W1

09/08

Embedded Languages

W2

09/xx

Multi-stage programming

W3

09/xx

From interpreters to compilers

W4

10/xx

Metaobject protocols and exotypes

W5

10/xx

Self-modifying interpreters and meta-tracing

W6

11/xx

Program generators for performance

W7

11/xx

Abstract interpretation

W8

11/xx

Partial evaluation

W9

11/xx

Probabilistic and logic programming

W10

12/xx

Project presentations

W11

12/xx

Project hand-in

W12

Topics/Reading

Semantics, Interpreters, Compilers, Abstract interpretation, Program analysis, Partial evaluation, Supercompilation, Generative programming, Embedded languages, Macros, Reflection