The Dolorem Pattern: Growing a Language Through Compile-Time Function Execution (Pearl/Brave New Idea)

Authors Simon Henniger, Nada Amin

Thumbnail PDF


  • Filesize: 0.69 MB
  • 27 pages

Document Identifiers

Author Details

Simon Henniger
  • Technische Universität München, Germany
Nada Amin
  • Harvard University, Cambridge, MA, USA


We thank Michael Ballantyne, Will Byrd, Anastasiya Kravchuk-Kirilyuk, and Cameron Wong for discussions about this work and feedback on drafts. We also thank anonymous reviewers for the insights and feedback.

Cite AsGet BibTex

Simon Henniger and Nada Amin. The Dolorem Pattern: Growing a Language Through Compile-Time Function Execution (Pearl/Brave New Idea). In 37th European Conference on Object-Oriented Programming (ECOOP 2023). Leibniz International Proceedings in Informatics (LIPIcs), Volume 263, pp. 41:1-41:27, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2023)


Programming languages are often designed as static, monolithic units. As a result, they are inflexible. We show a new mechanism of programming language design that allows to more flexible languages: by using compile-time function execution and metaprogramming, we implement a language mostly in itself. Our approach is usable for creating feature-rich, yet low-overhead system programming languages. We illustrate it on two systems, one that lowers to C and one that lowers to LLVM.

Subject Classification

ACM Subject Classification
  • Software and its engineering → Compilers
  • Software and its engineering → Language features
  • extensible languages
  • meta programming
  • macros
  • program generation
  • compilation


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Zachary DeVito, James Hegarty, Alex Aiken, Pat Hanrahan, and Jan Vitek. Terra: A multi-stage language for high-performance computing. SIGPLAN Not., 48(6):105-116, June 2013. URL:
  2. Gabriel Dos Reis and Bjarne Stroustrup. General constant expressions for system programming languages. In Proceedings of the 2010 ACM Symposium on Applied Computing, SAC '10, pages 2131-2136, New York, NY, USA, 2010. Association for Computing Machinery. URL:
  3. David Fisher and Olin Shivers. Building language towers with ziggurat. Journal of Functional Programming, 18(5-6):707-780, September 2008. URL:
  4. Oleg Kiselyov. The design and implementation of ber metaocaml. In Michael Codish and Eijiro Sumii, editors, Functional and Logic Programming, pages 86-102, Cham, 2014. Springer International Publishing. Google Scholar
  5. Eugene Kohlbecker, Daniel P. Friedman, Matthias Felleisen, and Bruce Duba. Hygienic macro expansion. In Proceedings of the 1986 ACM Conference on LISP and Functional Programming, LFP '86, pages 151-161, New York, NY, USA, 1986. Association for Computing Machinery. URL:
  6. Shriram Krishnamurthi, Matthias Felleisen, and Bruce F. Duba. From macros to reusable generative programming. In Krzysztof Czarnecki and Ulrich W. Eisenecker, editors, Generative and Component-Based Software Engineering, pages 105-120, Berlin, Heidelberg, 2000. Springer Berlin Heidelberg. Google Scholar
  7. Chris Lattner and Vikram Adve. LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation. In Proceedings of the 2004 International Symposium on Code Generation and Optimization (CGO'04), Palo Alto, California, March 2004. Google Scholar
  8. Gregory Neverov and Paul Roe. Metaphor: A multi-stage, object-oriented programming language. In Gabor Karsai and Eelco Visser, editors, Generative Programming and Component Engineering, pages 168-185, Berlin, Heidelberg, 2004. Springer Berlin Heidelberg. Google Scholar
  9. Tiark Rompf and Martin Odersky. Lightweight modular staging: A pragmatic approach to runtime code generation and compiled DSLs. Commun. ACM, 55(6):121-130, June 2012. URL:
  10. Walid Taha and Tim Sheard. MetaML and multi-stage programming with explicit annotations. Theoretical computer science, 248(1-2):211-242, October 2000. URL:
  11. Sam Tobin-Hochstadt, Vincent St-Amour, Ryan Culpepper, Matthew Flatt, and Matthias Felleisen. Languages as libraries. SIGPLAN Not., 46(6):132-141, June 2011. URL:
  12. Laurence Tratt. Domain specific language implementation via compile-time meta-programming. ACM Trans. Program. Lang. Syst., 30(6), October 2008. URL:
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail