diff options
| author | Michael Bryan <michaelfbryan@gmail.com> | 2018-01-20 22:13:39 +0800 |
|---|---|---|
| committer | Michael Bryan <michaelfbryan@gmail.com> | 2018-01-20 22:13:39 +0800 |
| commit | 68f0baedeb4e3fe59d3b2694ede9ae21a4ccce44 (patch) | |
| tree | d6005b1840a12daa7fbac6e1016fe387bfe48f76 /src/doc | |
| parent | 7c2f429b2546491a31f4498da314862bbf48dff9 (diff) | |
| download | rust-68f0baedeb4e3fe59d3b2694ede9ae21a4ccce44.tar.gz rust-68f0baedeb4e3fe59d3b2694ede9ae21a4ccce44.zip | |
Started working on the parser chapter
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/rustc-dev-guide/src/the-parser.md | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/doc/rustc-dev-guide/src/the-parser.md b/src/doc/rustc-dev-guide/src/the-parser.md index ab756895ae6..a43ae3398fc 100644 --- a/src/doc/rustc-dev-guide/src/the-parser.md +++ b/src/doc/rustc-dev-guide/src/the-parser.md @@ -1 +1,14 @@ -# The parser +# The Parser + +The parser is responsible for converting raw Rust source code into a structured +form which is easier for the compiler to work with, usually called an *Abstract +Syntax Tree*. The bulk of the parser lives in the [libsyntax] crate. + +The parsing process is made up of roughly 3 stages, + +- lexical analysis - turn a stream of characters into a stream of token trees +- macro expansion - run `proc-macros` and expand `macro_rules` macros +- parsing - turn the token trees into an AST + + +[libsyntax]: https://github.com/rust-lang/rust/tree/master/src/libsyntax |
