Domain-Specific Program Generation

Volume 3016 of the series Lecture Notes in Computer Science pp 30-50

A Gentle Introduction to Multi-stage Programming

  • Walid TahaAffiliated withDepartment of Computer Science, Rice University

* Final gross prices may vary according to local VAT.

Get Access


Multi-stage programming (MSP) is a paradigm for developing generic software that does not pay a runtime penalty for this generality. This is achieved through concise, carefully-designed language extensions that support runtime code generation and program execution. Additionally, type systems for MSP languages are designed to statically ensure that dynamically generated programs are type-safe, and therefore require no type checking after they are generated.

This hands-on tutorial is aimed at the reader interested in learning the basics of MSP practice. The tutorial uses a freely available MSP extension of OCaml called MetaOCaml, and presents a detailed analysis of the issues that arise in staging an interpreter for a small programming language. The tutorial concludes with pointers to various resources that can be used to probe further into related topics.