Skip to content

Commit

Permalink
minor edits
Browse files Browse the repository at this point in the history
  • Loading branch information
Noratrieb committed Sep 24, 2024
1 parent cba023d commit 5317005
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/syntax-intro.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# Syntax and the AST

Working directly with source code is very inconvenient and error-prone. Thus,
before we do anything else, we convert raw source code into an [Abstract Syntax
Tree (`AST`)][`AST`]. It turns out that doing even this involves a lot of work,
including [lexing, parsing], [`macro` expansion], [name resolution], conditional
compilation, [feature-gate checking], and [validation] of the [`AST`]. In this chapter,
we take a look at all of these steps.
Working directly with source code is very inconvenient and error-prone.
Thus, before we do anything else, we convert raw source code into an
[Abstract Syntax Tree (AST)][AST]. It turns out that doing this involves a lot of work,
including [lexing, parsing], [macro expansion], [name resolution], conditional
compilation, [feature-gate checking], and [validation] of the [AST].
In this chapter, we take a look at all of these steps.

Notably, there isn't always a clean ordering between these tasks. For example,
`macro` expansion relies on name resolution to resolve the names of `macro`s and
imports. And parsing requires `macro` expansion, which in turn may require
parsing the output of the `macro`.
Notably, there isn't always a clean ordering between these tasks.
For example, macro expansion relies on name resolution to resolve the names of macros and imports.
And parsing requires macro expansion, which in turn may require parsing the output of the macro.

[`AST`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/index.html
[`macro` expansion]: ./macro-expansion.md
[AST]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/index.html
[macro expansion]: ./macro-expansion.md
[feature-gate checking]: ./feature-gate-ck.md
[lexing, parsing]: ./lexing-parsing.md
[name resolution]: ./name-resolution.md
[validation]: ./ast-validation.md
[validation]: ./ast-validation.md

0 comments on commit 5317005

Please sign in to comment.