|
1 | 1 | # Syntax and the AST
|
2 | 2 |
|
3 |
| -Working directly with source code is very inconvenient and error-prone. Thus, |
4 |
| -before we do anything else, we convert raw source code into an [Abstract Syntax |
5 |
| -Tree (`AST`)][`AST`]. It turns out that doing even this involves a lot of work, |
6 |
| -including [lexing, parsing], [`macro` expansion], [name resolution], conditional |
7 |
| -compilation, [feature-gate checking], and [validation] of the [`AST`]. In this chapter, |
8 |
| -we take a look at all of these steps. |
| 3 | +Working directly with source code is very inconvenient and error-prone. |
| 4 | +Thus, before we do anything else, we convert raw source code into an |
| 5 | +[Abstract Syntax Tree (AST)][AST]. It turns out that doing this involves a lot of work, |
| 6 | +including [lexing, parsing], [macro expansion], [name resolution], conditional |
| 7 | +compilation, [feature-gate checking], and [validation] of the [AST]. |
| 8 | +In this chapter, we take a look at all of these steps. |
9 | 9 |
|
10 |
| -Notably, there isn't always a clean ordering between these tasks. For example, |
11 |
| -`macro` expansion relies on name resolution to resolve the names of `macro`s and |
12 |
| -imports. And parsing requires `macro` expansion, which in turn may require |
13 |
| -parsing the output of the `macro`. |
| 10 | +Notably, there isn't always a clean ordering between these tasks. |
| 11 | +For example, macro expansion relies on name resolution to resolve the names of macros and imports. |
| 12 | +And parsing requires macro expansion, which in turn may require parsing the output of the macro. |
14 | 13 |
|
15 |
| -[`AST`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/index.html |
16 |
| -[`macro` expansion]: ./macro-expansion.md |
| 14 | +[AST]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/index.html |
| 15 | +[macro expansion]: ./macro-expansion.md |
17 | 16 | [feature-gate checking]: ./feature-gate-ck.md
|
18 | 17 | [lexing, parsing]: ./lexing-parsing.md
|
19 | 18 | [name resolution]: ./name-resolution.md
|
20 |
| -[validation]: ./ast-validation.md |
| 19 | +[validation]: ./ast-validation.md |
0 commit comments