How Rust models generators and async functions as memory efficient state machines:
miniblog.
Related Posts
C# has an interesting concept of second-class macros called Source Generators: https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/
You can generate additional code at build time, but you can't transform existing expressions (unlike normal macros), so it's more amenable to tooling.
A survey of parser generator usage in major language implementationss: https://notes.eatonphil.com/parser-generators-vs-handwritten-parsers-survey-2021.html
Most have a handwritten parser. GCC and Go moved from generated to handwritten. SQLite and Python <3.10 built their own parser generators!
Cute demonstration of implementing generators in terms of delimited continuations: https://defn.io/2019/09/05/racket-generators/
It might be Scheme, but the examples have a lot of syntax! parameterize, let loop, variadic functions, call-with-continuation-prompt (with 2 or 3 args).
