[overview.md] Add command line argument parsing, lexer stages, and parser outline
This commit is contained in:
parent
a43ef4d3b3
commit
0783019c12
|
|
@ -19,16 +19,16 @@ we'll talk about that later.
|
||||||
|
|
||||||
**TODO: someone else should confirm this vvv**
|
**TODO: someone else should confirm this vvv**
|
||||||
|
|
||||||
- User writes a program and invokes `rustc` on it (possibly through `cargo`).
|
- The compile process begins when a user writes a Rust source program in text and invokes the `rustc` compiler on it. The work that the compiler needs to perform is defined with command line options. For example, it is possible to optionally enable nightly features, perform `check`-only builds, or emit LLVM-IR rather than complete the entire compile process defined here. The `rustc` executable call may be indirect through the use of `cargo`.
|
||||||
- First, we parse command line flags, etc. This is done in [`librustc_driver`].
|
- Command line argument parsing occurs in the [`librustc_driver`]. This crate defines the compile configuration that is requested by the user.
|
||||||
We now know what the exact work is we need to do (e.g. which nightly features
|
- The raw Rust source text is analyzed by a low-level lexer located in [`librustc_lexer`]. At this stage, the source text is turned into a stream of atomic source code units known as _tokens_. (**TODO**: chrissimpkins - Maybe discuss Unicode handling during this stage?)
|
||||||
are enabled, whether we are doing a `check`-only build or emiting LLVM-IR or
|
- The token stream passes through a higher-level lexer located in [`librustc_parse`] to prepare for the next stage of the compile process. The [`StringReader`] struct is used at this stage to perform a set of validations and turn strings into interned symbols.
|
||||||
a full compilation).
|
- (**TODO**: chrissimpkins - Expand info on parser) We then [_parse_ the stream of tokens][parser] to build an Abstract Syntax Tree (AST).
|
||||||
- Then, we start to do compilation...
|
- macro expansion (**TODO** chrissimpkins)
|
||||||
- We first [_lex_ the user program][lex]. This turns the program into a stream
|
- ast validation (**TODO** chrissimpkins)
|
||||||
of _tokens_ (yes, the same sort of tokens as `proc_macros` (sort of)).
|
- nameres (**TODO** chrissimpkins)
|
||||||
[`StringReader`] from [`librustc_parse`] integrates [`librustc_lexer`] with
|
- early linting (**TODO** chrissimpkins)
|
||||||
`rustc` data structures.
|
|
||||||
- We then [_parse_ the stream of tokens][parser] to build an Abstract Syntax
|
- We then [_parse_ the stream of tokens][parser] to build an Abstract Syntax
|
||||||
Tree (AST).
|
Tree (AST).
|
||||||
- We then take the AST and [convert it to High-Level Intermediate
|
- We then take the AST and [convert it to High-Level Intermediate
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue