Terra https://terralang.org/ lets you define Lua scripts that generate code in a compilable Lua subset. Cf a preprocessor. Mind-bending.
miniblog.
Related Posts
A wonderful article explaining how compiler drivers work, clarifying the relationship between the preprocessor, the compiler proper, and the linker:
Here's a scary example from the tree-sitter-c bug tracker: before running the preprocessor, there's no guarantee that C code will parse!
(Typically it will I think, but no guarantees.)
Esy is a JS preprocessor that lets you define your own blocks: https://www.npmjs.com/package/esy-language
It's a macro system, but it doesn't overlap with function call syntax (unlike e.g. lisp). It makes it a little easier to spot macros, without a whole separate namespace (like foo! in Rust).
