Anything you can do, I can do worse with macro_rules!
February 09, 2024
25 min
Free
rust
macros
declarative-macros
token-trees
metaprogramming
compiler-internals
abstract-syntax-tree
recursion
debugging
Description
This talk delves into the capabilities of Rust's `macro_rules!` for metaprogramming, exploring how to create complex transformations, including generating traits from XML-like syntax. The presentation covers various macro patterns like recursion, incremental token tree munchers, push-down accumulation, token tree bundling, and callbacks, while also touching on debugging techniques for declarative macros. The speaker emphasizes that declarative macros are powerful enough for tasks often reserved for procedural macros, potentially simplifying projects and reducing compile times.