Macros for domain-specific languages
Michael Ballantyne, Alexis King, Matthias Felleisen
Abstract
Macros provide a powerful means of extending languages. They have proven useful in both general-purpose and domain-specific programming contexts. This paper presents an architecture for implementing macro-extensible DSLs on top of macro-extensible host languages. The macro expanders of these DSLs inherit the syntax system, hygienic expansion, and more from the host. They transform the extensible DSL syntax into a DSL core language. This arrangement has several important consequences. It becomes straightforward to integrate the syntax of various DSLs and the host language when their expanders share these inherited components. Also, a DSL compiler may be designed around a fixed core language, even for an extensible DSL. Finally, macros empower programmers to safely grow DSLs on their own and tailor them to their needs.
Ask about this paper
Ask your agent about it.
Lune has read the top-tier papers around this one, so every answer names the papers it rests on.
Your agent calls
Lunesearch_papers
Free to start. No credit card required.
Terminal
Install the CLIlune papers get bbb73086-fd8f-488c-8e1a-5983fb3d0881Cited by top-tier papers3
- Exo 2: Growing a Scheduling LanguageYuka Ikarashi, Kevin Qian, Samir Droubi, Alex Reinking et al.ASPLOS 2025 · 7 citations
- Rhombus: A New Spin on Macros without All the ParenthesesMatthew Flatt, Taylor Allred, Nia Angle, Stephen De Gabrielle et al.OOPSLA 2023 · 5 citations
- Compositional embeddings of domain-specific languagesYaozhu Sun, Utkarsh Dhandhania, Bruno C. d. S. OliveiraOOPSLA 2022 · 4 citations
Related papers
- MimIR: An Extensible and Type-Safe Intermediate Representation for the DSL AgeRoland Leißa, Marcel Ullrich, Joachim Meyer, Sebastian HackPOPL 2025 · 1 citation
- Dependent type systems as macrosStephen Chang, Michael Ballantyne, Milo Turner, William J. BowmanPOPL 2020 · 8 citations
- Modular Type Safety for Traits with Extensible Variants and Deep Pattern MatchingAndong Fan, Lionel Parreaux, Ningning XieOOPSLA 2026
- IRDL: an IR definition language for SSA compilersMathieu Fehr, Jeff Niu, River Riddle, Mehdi Amini et al.PLDI 2022 · 13 citations
- Pyrosome: Verified Compilation for Modular MetatheoryDustin Jamner, Gabriel Kammer, Ritam Nag, Adam ChlipalaOOPSLA 2025
