@@ -43,16 +43,17 @@ we'll talk about that later.
43
43
- The lexer preserves full fidelity information for both IDEs and proc macros.
44
44
- The parser [ translates the token stream from the lexer into an Abstract Syntax
45
45
Tree (AST)] [ parser ] . It uses a recursive descent (top-down) approach to syntax
46
- analysis. The crate entry points for the parser are the ` Parser::parse_crate_mod() ` and
47
- ` Parser::parse_mod() ` methods found in ` rustc_parse::parser::Parser ` . The external
48
- module parsing entry point is ` rustc_expand::module::parse_external_mod ` . And
49
- the macro parser entry point is [ ` Parser::parse_nonterminal() ` ] [ parse_nonterminal ] .
46
+ analysis. The crate entry points for the parser are the
47
+ [ ` Parser::parse_crate_mod() ` ] [ parse_crate_mod ] and [ ` Parser::parse_mod() ` ] [ parse_mod ]
48
+ methods found in [ ` rustc_parse::parser::Parser ` ] . The external module parsing
49
+ entry point is [ ` rustc_expand::module::parse_external_mod ` ] [ parse_external_mod ] .
50
+ And the macro parser entry point is [ ` Parser::parse_nonterminal() ` ] [ parse_nonterminal ] .
50
51
- Parsing is performed with a set of ` Parser ` utility methods including ` fn bump ` ,
51
52
` fn check ` , ` fn eat ` , ` fn expect ` , ` fn look_ahead ` .
52
53
- Parsing is organized by the semantic construct that is being parsed. Separate
53
- ` parse_* ` methods can be found in ` rustc_parse ` ` parser ` directory. The source
54
- file name follows the construct name. For example, the following files are found
55
- in the parser:
54
+ ` parse_* ` methods can be found in [ ` rustc_parse ` ` parser ` ] [ rustc_parse_parser_dir ]
55
+ directory. The source file name follows the construct name. For example, the
56
+ following files are found in the parser:
56
57
- ` expr.rs `
57
58
- ` pat.rs `
58
59
- ` ty.rs `
@@ -123,6 +124,11 @@ we'll talk about that later.
123
124
[ `simplify_try` ] : https://github.com/rust-lang/rust/pull/66282
124
125
[ codegen ] : https://rustc-dev-guide.rust-lang.org/backend/codegen.html
125
126
[ parse_nonterminal ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/parser/struct.Parser.html#method.parse_nonterminal
127
+ [ parse_crate_mod ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/parser/struct.Parser.html#method.parse_crate_mod
128
+ [ parse_mod ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/parser/struct.Parser.html#method.parse_mod
129
+ [ `rustc_parse::parser::Parser` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/parser/struct.Parser.html
130
+ [ parse_external_mod ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/module/fn.parse_external_mod.html
131
+ [ rustc_parse_parser_dir ] : https://github.com/rust-lang/rust/tree/master/compiler/rustc_parse/src/parser
126
132
127
133
## How it does it
128
134
0 commit comments