Impractical Macros
summary
A Rust macro actually interprets Brainfuck entirely at compile time, producing Rust code that evaluates to a struct literal and simple additions; it uses macro_rules 1.0! and token lists as integers (a homemade Zermelo numbers encoding), a zipper to represent tape and a pair of stacks to implement nested loops, plus a decimal-digit tokenizer. The macro requires a raised recursion_limit, runs the demo and prints the expected output, showing the implementation works despite being intentionally impractical.
AI-written summary · about
chapters (7)
related talks
24mMacros for a More Productive Rust
39mRust metaprogramming - macro_rules! beyond basics
31mFunctional programming guerilla in the land of Rust
25m"Eternal Sunshine of the Rustfmt'ed Mind"
32mLive Coding
29mLearning Rust by accident
41mFunctional Rust - An Exploration
21mProving macro expansion with expandable
