Start macro expansion chapter

This commit is contained in:
Mark Mansi 2018-01-25 15:56:06 -06:00
parent af83b8e8d4
commit 1c92abebd6
1 changed files with 11 additions and 0 deletions

View File

@ -1 +1,12 @@
# Macro expansion
Macro expansion happens during parsing. `rustc` has two parsers, in fact: the
normal Rust parser, and the macro parser. During the parsing phase, the normal
Rust parser will call into the macro parser when it encounters a macro. The
macro parser, in turn, may call back out to the Rust parser when it needs to
bind a metavariable (e.g. `$expr`). There are a few aspects of this system to be
explained. The code for macro expansion is in `src/libsyntax/ext/tt/`.
TODO: explain parsing of macro definitions
TODO: explain parsing of macro invokations + macro expansion