2 ms·
> Rust procedural macros are like external tools, manipulating the AST as a structure. Isn't viewing them as like external tools just a C centric view, based o
by kbenson 7y ago
> Rust procedural macros are like external tools, manipulating the AST as a structure.
Isn't viewing them as like external tools just a C centric view, based on C's (and C++'s) capabilities? Didn't Lisp have macros that manipulated the language as an AST prior to C even existing, inside the language?
- floatboth 7y agoWell, Rust is closer to C++ than Lisp :) If you look at the API https://blog.rust-lang.org/2018/12/21/Procedural-Macros-in-Rust-2018.html https://blog.rust-lang.org/2018/12/21/Procedural-Macros-in-R... it works on the level of raw tokens, not even the AST. So you have to construct your own AST via the parser if you want to manipulate AST.