Programming Languages

Metaprogramming Seminar

Metaprograms process and produce source code. A metaprogram treats a regular program as data and thus enables abstractions and reflections outside the scope of regular programming languages. Metaprogramming is widely applied in programming languages. From C++ templates and syntactic macros, to model-driven development, domain-specific languages and aspect-oriented programming: Metaprogramming plays a significant role in many modern programming systems. In this seminar, we study the foundations of metaprogramming and its applications in modern software development by reading research papers on the topic.

More details will be announced through this page.


Paolo Giarrusso
Paolo Giarrusso
(Office: Room B211)
Prof. Klaus Ostermann
Klaus Ostermann

Seminar schedule

Each week, please prepare and submit a summary and questions by the Monday, 23:59 before the meeting.

  1. Tuesday 28.10.
    On programs as data: McCarthy, 1960. Recursive functions of symbolic expressions and their computation by machine, part 1, Communications of the ACM. The original version is here.
    Bibliographic data/official version.
    Feel free to skip Sec. 5.

    Discussion leader: Paolo.

  2. Tuesday 4.11.
    On macros: Weise and Crew, 1993. Programmable Syntax Macros, Proceedings of PLDI.
    Bibliographic data/official version.

    Discussion leader: Werner.

  3. Tuesday 11.11.
    On syntax macros and sugar libraries: Erdweg, Rendel, Kästner, and Ostermann, 2011. SugarJ: Library-based syntactic language extensibility, Proceedings of OOPSLA.
    Bibliographic data/official version.

    Discussion leader: Julian.

  4. Tuesday 18.11.
    On staging: Walid Taha and Tim Sheard, 1997. Multi-stage programming with explicit annotations, Proceedings of PEPM.
    Bibliographic data/official version.

    Please focus on Sec. 1-10 and 13, but take a look at the rest.
    Discussion leader: Kristina.

  5. Tuesday 25.11.
    On Template Haskell: Tim Sheard and Simon Peyton Jones, 2002. Template meta-programming for Haskell, Proceedings of Haskell Workshop.
    Bibliographic data/official version.

    Discussion leader: Jonas.

    Focus on the high-level picture (as discussed by the guides to reading papers), not so much on the details of the Haskell API. My suggestion is to please focus on Sec. 1-5, 10 and 12, skim Sec. 6, 7, 8.1, 9, but skip Sec. 9.3.

    See also, for background on the notation of Fig. 2 (in Sec. 7), this note by Prof. Jeremy Siek. Understanding code snippets is not so critical, but some cheatsheets exist, though I’m not sure which to recommend.

  6. Tuesday 2.12.
    On domain-specific languages and deep embedding: Conal Elliott, Sigbjørn Finne and Oege De Moor, 2003. Compiling embedded languages, Journal of Functional Programming.
    Bibliographic data/official version.

    Discussion leader: Jan.

  7. Tuesday 9.12.
    On hygienic macros: Eugene Kohlbecker, Daniel P. Friedman, Matthias Felleisen, Bruce Duba, 1986. Hygienic macro expansion, Proceedings of LFP (Conference on LISP and Functional Programming).
    Bibliographic data/official version.

    Discussion leader: Padmani.

  8. Tuesday 16.12. Lecture on writing. Slides.

    Christmas break

  9. Tuesday 13.01. Topic choice.

  10. Tuesday 20.01. Canceled.

  11. Tuesday 27.01.

    Discussion leader: Paolo.

  12. Tuesday 3.02.
    • On DSLs, staging and language virtualization: Rompf and Odersky, 2012. Lightweight modular staging: a pragmatic approach to runtime code generation and compiled DSLs. Communications of the ACM.
      Bibliographic data/official version.

    Discussion leader: Paolo.

  13. Tuesday 10.02. Canceled.

Other relevant papers

Possible topics for term papers

This is a short list of possible topics, as we discussed briefly. I added question marks for topics which could be more problematic — please discuss with me if you are interested in those. And contact me for any further information.

  • Staging in general
  • Lightweight modular staging & language virtualization
  • (Deeply) embedded DSLs
  • Macros
  • Hygienic macros
  • Other kinds of DSLs?

Formatting instructions for term papers

Other info

Language: English
Credits: 4 LP
LSF entry
Weekly meeting: Tuesday, 18:15-19:45 — room C311
Contact email: paolo (dot) giarrusso (at) uni-tuebingen (dot) de

Kick-off meeting

21.10.2014 17:15-19:00, Room A302.
Introduction slides.

Course structure

During the semester, we will discuss together a paper each week in a meeting. Everybody should read the paper in advance, prepare and submit a short summary and questions (150-300 words). A discussion leader should dig deeper on the topic, also based on the questions by other students, and prepare to moderate the discussion. The role of discussion leader rotates among students.

At the end of the semester, each participant should submit a short term paper, surveying one of the discussed topics.

The seminar is graded, and the final grade depends on both the summaries, the participation to the discussion, and the final term paper.

Tips on reading papers

There are different approaches to reading a research paper, some more productive than others. While there are no strict rules, you might want to take a look at the following:

Absence policy

This seminar is a discussion seminar, so it is necessary that you actually attend meetings in order to benefit from the seminar and pass the exam.

You are allowed to miss at most two of the meetings and still pass the seminar. Should this become a problem and should the absences be due to justifiable reasons, we might be able to agree on alternative loads to compensate for the absences.