This document describes Ruby macros and how they are implemented using Ruby's parse tree represented as nested Node objects. Key points include:
- Macros allow code to be executed at parse time by transforming the parse tree before it is executed.
- The parse tree is represented as a hierarchy of Node objects descended from Array, with nodes addressing subnodes like a normal Array.
- Implementing macros requires first parsing the code into a Node tree using RedParse, then transforming the tree before executing it.
- This allows macros to modify the code before it runs, but preprocessing is slow and there are limitations on macro usage and scoping.