Macros for Domain-Specific Languages
summary
Presents an implementation of a two-layer expander API for Racket that lets internal DSLs get their own expander and compiler while reusing host services like scopes, hygiene, and the expander environment. Demonstrates a PEG DSL that enforces left-recursion prohibition, compiles character-only alternatives to a binary-search optimization, and wires parse-variable bindings into Racket so IDE features like jump-to-definition work. Migrating four existing DSLs (Typed Racket, Rash, miniKanren, cmdline) shows the approach enables macro extensibility and new compiler-level optimizations.
AI-written summary · about
chapters (9)
- 0:00Introduction to DSLs
- 2:57Extensible DSL Architecture
- 3:47DSL Compiler Pipeline
- 5:08Parser Expression Grammars
- 7:04Extending the PEG DSL
- 9:10Expander API and Scoping
- 11:14Environment Integration
- 14:29Evaluation and Impact
- 16:06Conclusion
related talks
40mLet's Build a Hygienic Macro Expander
01h 03mModern Macros
22mDSLs in Racket: You Want It How, Now?
45mLanguage-Oriented Programming with Racket
23mMacro-embedding Compiler Intermediate Languages in Racket
01h 01mChallenges in the Design and Implementation of Teaching Languages for EDSLs
37mMetaprogramming + DSL Design in Elixir
25mRewriting Macros on the Fly: A Modular Approach to Administrative Reduction During(…)
