Skip to content

Commit 7d697a9

Browse files
committed
Edit parsing (cont)
1 parent 5ee6d33 commit 7d697a9

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/overview.md

+21
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,27 @@ And the macro parser entry point is [`Parser::parse_nonterminal()`][parse_nonter
148148
Parsing is performed with a set of `Parser` utility methods including `bump`,
149149
`check`, `eat`, `expect`, `look_ahead`.
150150

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+
151172

152173
[String interning]: https://en.wikipedia.org/wiki/String_interning
153174
[`rustc_lexer`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lexer/index.html

0 commit comments

Comments
 (0)