@@ -28,8 +28,8 @@ we'll talk about that later.
28
28
to the rest of the compilation process as a [ ` rustc_interface::Config ` ] .
29
29
- The raw Rust source text is analyzed by a low-level lexer located in
30
30
[ ` librustc_lexer ` ] . At this stage, the source text is turned into a stream of
31
- atomic source code units known as _ tokens_ . The lexer supports the Unicode
32
- character encoding.
31
+ atomic source code units known as _ tokens_ . The lexer supports the
32
+ Unicode character encoding.
33
33
- The token stream passes through a higher-level lexer located in
34
34
[ ` librustc_parse ` ] to prepare for the next stage of the compile process. The
35
35
[ ` StringReader ` ] struct is used at this stage to perform a set of validations
@@ -47,25 +47,21 @@ we'll talk about that later.
47
47
- Parsing is performed with a set of ` Parser ` utility methods including ` fn bump ` ,
48
48
` fn check ` , ` fn eat ` , ` fn expect ` , ` fn look_ahead ` .
49
49
- Parsing is organized by the semantic construct that is being parsed. Separate
50
- ` parse_* ` methods can be found in ` librustc_parse ` ` parser ` directory. File
51
- naming follows the construct name. For example, the following files are found
50
+ ` parse_* ` methods can be found in ` librustc_parse ` ` parser ` directory. The source
51
+ file name follows the construct name. For example, the following files are found
52
52
in the parser:
53
53
- ` expr.rs `
54
54
- ` pat.rs `
55
55
- ` ty.rs `
56
56
- ` stmt.rs `
57
- - This naming scheme is used across the parser, lowering, type checking,
58
- HAIR lowering, & MIR building stages of the compile process and you will
59
- find either a file or directory with the same name for most of these constructs
60
- at each of these stages of compilation.
61
- - For error handling, the parser uses the standard ` DiagnosticBuilder ` API, but we
57
+ - This naming scheme is used across many compiler stages. You will find
58
+ either a file or directory with the same name across the parsing, lowering,
59
+ type checking, HAIR lowering, and MIR building sources.
60
+ - Macro expansion, AST validation, name resolution, and early linting takes place
61
+ during this stage of the compile process.
62
+ - The parser uses the standard ` DiagnosticBuilder ` API for error handling, but we
62
63
try to recover, parsing a superset of Rust's grammar, while also emitting an error.
63
- - The ` rustc_ast::ast::{Crate, Mod, Expr, Pat, ...} ` AST node returned from the parser.
64
- - macro expansion (** TODO** chrissimpkins)
65
- - ast validation (** TODO** chrissimpkins)
66
- - nameres (** TODO** chrissimpkins)
67
- - early linting (** TODO** chrissimpkins)
68
-
64
+ - ` rustc_ast::ast::{Crate, Mod, Expr, Pat, ...} ` AST nodes are returned from the parser.
69
65
- We then take the AST and [ convert it to High-Level Intermediate
70
66
Representation (HIR)] [ hir ] . This is a compiler-friendly representation of the
71
67
AST. This involves a lot of desugaring of things like loops and ` async fn ` .
0 commit comments