Update syntax-intro.md

This commit is contained in:
Tbkhi 2024-03-10 17:29:26 -03:00 committed by nora
parent 91d6ab9de4
commit cba023dd48
1 changed files with 15 additions and 8 deletions

View File

@ -1,13 +1,20 @@
# Syntax and the AST # Syntax and the AST
Working directly with source code is very inconvenient and error-prone. Thus, 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 before we do anything else, we convert raw source code into an [Abstract Syntax
out that doing even this involves a lot of work, including lexing, parsing, Tree (`AST`)][`AST`]. It turns out that doing even this involves a lot of work,
macro expansion, name resolution, conditional compilation, feature-gate including [lexing, parsing], [`macro` expansion], [name resolution], conditional
checking, and validation of the AST. In this chapter, we take a look at all compilation, [feature-gate checking], and [validation] of the [`AST`]. In this chapter,
of these steps. we take a look at all of these steps.
Notably, there isn't always a clean ordering between these tasks. For example, 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 `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 imports. And parsing requires `macro` expansion, which in turn may require
parsing the output of the macro. 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