Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update syntax-intro.md #1932

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions src/syntax-intro.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# 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 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.
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.

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.
`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`.

[`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