diff options
| author | Mark Mansi <markm@cs.wisc.edu> | 2018-01-25 15:56:06 -0600 |
|---|---|---|
| committer | Mark Mansi <markm@cs.wisc.edu> | 2018-01-25 15:58:47 -0600 |
| commit | c83e283d7f8fb79c8f938aa90057296c534a3817 (patch) | |
| tree | 2b669962f27b576136236f7b45a649d9563f5717 /src/doc | |
| parent | 68a4ac0ce4b19bf3ec87fa97f5e08bc4867d39b8 (diff) | |
| download | rust-c83e283d7f8fb79c8f938aa90057296c534a3817.tar.gz rust-c83e283d7f8fb79c8f938aa90057296c534a3817.zip | |
Start macro expansion chapter
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/rustc-dev-guide/src/macro-expansion.md | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/doc/rustc-dev-guide/src/macro-expansion.md b/src/doc/rustc-dev-guide/src/macro-expansion.md index 12b95cb6cb0..7ab1c35bc78 100644 --- a/src/doc/rustc-dev-guide/src/macro-expansion.md +++ b/src/doc/rustc-dev-guide/src/macro-expansion.md @@ -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 |
