@@ -148,6 +148,27 @@ And the macro parser entry point is [`Parser::parse_nonterminal()`][parse_nonter
148
148
Parsing is performed with a set of ` Parser ` utility methods including ` bump ` ,
149
149
` check ` , ` eat ` , ` expect ` , ` look_ahead ` .
150
150
151
+ Parsing is organized by the semantic construct that is being parsed. Separate
152
+ ` parse_* ` methods can be found in [ ` rustc_parse ` ` parser ` ] [ rustc_parse_parser_dir ]
153
+ directory. The source file name follows the construct name. For example, the
154
+ following files are found in the parser:
155
+
156
+ - ` expr.rs `
157
+ - ` pat.rs `
158
+ - ` ty.rs `
159
+ - ` stmt.rs `
160
+
161
+ This naming scheme is used across many compiler stages. You will find
162
+ either a file or directory with the same name across the parsing, lowering,
163
+ type checking, THIR lowering, and MIR building sources.
164
+
165
+ Macro expansion, AST validation, name resolution, and early linting also take place
166
+ during this stage.
167
+
168
+ The parser uses the standard ` DiagnosticBuilder ` API for error handling, but we
169
+ try to recover, parsing a superset of Rust's grammar, while also emitting an error.
170
+ ` rustc_ast::ast::{Crate, Mod, Expr, Pat, ...} ` AST nodes are returned from the parser.
171
+
151
172
152
173
[ String interning ] : https://en.wikipedia.org/wiki/String_interning
153
174
[ `rustc_lexer` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lexer/index.html
0 commit comments