Skip to content

Commit 4a416a7

Browse files
committed
Split overview chapter into summative overview and a walkthrough
1 parent f66b472 commit 4a416a7

File tree

3 files changed

+63
-61
lines changed

3 files changed

+63
-61
lines changed

src/SUMMARY.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
# High-level Compiler Architecture
6868

6969
- [Prologue](./part-2-intro.md)
70-
- [Overview of the compiler](./overview.md)
70+
- [Overview of the compiler](./overview/overview.md)
71+
- [Compiling a Program: A Walkthrough](./overview/walkthrough.md)
7172
- [The compiler source code](./compiler-src.md)
7273
- [Queries: demand-driven compilation](./query.md)
7374
- [The Query Evaluation Model in Detail](./queries/query-evaluation-model-in-detail.md)

src/overview/overview.md

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Overview of the compiler
2+
3+
> **WORK IN PROGRESS**
4+
5+
# References
6+
7+
- Command line parsing
8+
- Guide: [The Rustc Driver and Interface](rustc-driver.md)
9+
- Driver definition: [`rustc_driver`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/)
10+
- Main entry point: [`rustc_session::config::build_session_options`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/config/fn.build_session_options.html)
11+
- Lexical Analysis: Lex the user program to a stream of tokens
12+
- Guide: [Lexing and Parsing](the-parser.md)
13+
- Lexer definition: [`rustc_lexer`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lexer/index.html)
14+
- Main entry point: [`rustc_lexer::cursor::Cursor::advance_token`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lexer/cursor/struct.Cursor.html#method.advance_token)
15+
- Parsing: Parse the stream of tokens to an Abstract Syntax Tree (AST)
16+
- Guide: [Lexing and Parsing](the-parser.md)
17+
- Guide: [Macro Expansion](macro-expansion.md)
18+
- Guide: [Name Resolution](name-resolution.md)
19+
- Parser definition: [`rustc_parse`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/index.html)
20+
- Main entry points:
21+
- [Entry point for first file in crate](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/passes/fn.parse.html)
22+
- [Entry point for outline module parsing](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/module/fn.parse_external_mod.html)
23+
- [Entry point for macro fragments][parse_nonterminal]
24+
- `AST` definition: [`rustc_ast`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast/ast/index.html)
25+
- Feature gating: **TODO**
26+
- Early linting: **TODO**
27+
- The High Level Intermediate Representation (HIR)
28+
- Guide: [The HIR](hir.md)
29+
- Guide: [Identifiers in the HIR](hir.md#identifiers-in-the-hir)
30+
- Guide: [The `HIR` Map](hir.md#the-hir-map)
31+
- Guide: [Lowering `AST` to `HIR`](ast-lowering.md)
32+
- How to view `HIR` representation for your code `cargo rustc -- -Z unpretty=hir-tree`
33+
- Rustc `HIR` definition: [`rustc_hir`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/index.html)
34+
- Main entry point: **TODO**
35+
- Late linting: **TODO**
36+
- Type Inference
37+
- Guide: [Type Inference](type-inference.md)
38+
- Guide: [The ty Module: Representing Types](ty.md) (semantics)
39+
- Main entry point (type inference): [`InferCtxtBuilder::enter`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/struct.InferCtxtBuilder.html#method.enter)
40+
- Main entry point (type checking bodies): [the `typeck` query](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.typeck)
41+
- These two functions can't be decoupled.
42+
- The Mid Level Intermediate Representation (MIR)
43+
- Guide: [The `MIR` (Mid level IR)](mir/index.md)
44+
- Definition: [`rustc_middle/src/mir`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/index.html)
45+
- Definition of sources that manipulates the MIR: [`rustc_mir_build`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_build/index.html), [`rustc_mir_dataflow`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_dataflow/index.html), [`rustc_mir_transform`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_transform/index.html)
46+
- The Borrow Checker
47+
- Guide: [MIR Borrow Check](borrow_check.md)
48+
- Definition: [`rustc_borrowck`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_borrowck/index.html)
49+
- Main entry point: [`mir_borrowck` query](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_borrowck/fn.mir_borrowck.html)
50+
- `MIR` Optimizations
51+
- Guide: [MIR Optimizations](mir/optimizations.md)
52+
- Definition: [`rustc_mir_transform`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_transform/index.html)
53+
- Main entry point: [`optimized_mir` query](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_transform/fn.optimized_mir.html)
54+
- Code Generation
55+
- Guide: [Code Generation](backend/codegen.md)
56+
- Generating Machine Code from `LLVM-IR` with LLVM - **TODO: reference?**
57+
- Main entry point: [`rustc_codegen_ssa::base::codegen_crate`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/base/fn.codegen_crate.html)
58+
- This monomorphizes and produces `LLVM-IR` for one codegen unit. It then
59+
starts a background thread to run LLVM, which must be joined later.
60+
- Monomorphization happens lazily via [`FunctionCx::monomorphize`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/mir/struct.FunctionCx.html#method.monomorphize) and [`rustc_codegen_ssa::base::codegen_instance `](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/base/fn.codegen_instance.html)

src/overview.md renamed to src/overview/walkthrough.md

+1-60
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Overview of the compiler
2-
3-
<!-- toc -->
1+
# Compiling a Program: A Walkthrough
42

53
This chapter is about the overall process of compiling a program -- how
64
everything fits together.
@@ -383,60 +381,3 @@ For more details on bootstrapping, see
383381
- Where do phases diverge for cross-compilation to machine code across
384382
different platforms?
385383
-->
386-
387-
# References
388-
389-
- Command line parsing
390-
- Guide: [The Rustc Driver and Interface](rustc-driver.md)
391-
- Driver definition: [`rustc_driver`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/)
392-
- Main entry point: [`rustc_session::config::build_session_options`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/config/fn.build_session_options.html)
393-
- Lexical Analysis: Lex the user program to a stream of tokens
394-
- Guide: [Lexing and Parsing](the-parser.md)
395-
- Lexer definition: [`rustc_lexer`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lexer/index.html)
396-
- Main entry point: [`rustc_lexer::cursor::Cursor::advance_token`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lexer/cursor/struct.Cursor.html#method.advance_token)
397-
- Parsing: Parse the stream of tokens to an Abstract Syntax Tree (AST)
398-
- Guide: [Lexing and Parsing](the-parser.md)
399-
- Guide: [Macro Expansion](macro-expansion.md)
400-
- Guide: [Name Resolution](name-resolution.md)
401-
- Parser definition: [`rustc_parse`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/index.html)
402-
- Main entry points:
403-
- [Entry point for first file in crate](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/passes/fn.parse.html)
404-
- [Entry point for outline module parsing](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/module/fn.parse_external_mod.html)
405-
- [Entry point for macro fragments][parse_nonterminal]
406-
- `AST` definition: [`rustc_ast`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast/ast/index.html)
407-
- Feature gating: **TODO**
408-
- Early linting: **TODO**
409-
- The High Level Intermediate Representation (HIR)
410-
- Guide: [The HIR](hir.md)
411-
- Guide: [Identifiers in the HIR](hir.md#identifiers-in-the-hir)
412-
- Guide: [The `HIR` Map](hir.md#the-hir-map)
413-
- Guide: [Lowering `AST` to `HIR`](ast-lowering.md)
414-
- How to view `HIR` representation for your code `cargo rustc -- -Z unpretty=hir-tree`
415-
- Rustc `HIR` definition: [`rustc_hir`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/index.html)
416-
- Main entry point: **TODO**
417-
- Late linting: **TODO**
418-
- Type Inference
419-
- Guide: [Type Inference](type-inference.md)
420-
- Guide: [The ty Module: Representing Types](ty.md) (semantics)
421-
- Main entry point (type inference): [`InferCtxtBuilder::enter`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/struct.InferCtxtBuilder.html#method.enter)
422-
- Main entry point (type checking bodies): [the `typeck` query](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.typeck)
423-
- These two functions can't be decoupled.
424-
- The Mid Level Intermediate Representation (MIR)
425-
- Guide: [The `MIR` (Mid level IR)](mir/index.md)
426-
- Definition: [`rustc_middle/src/mir`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/index.html)
427-
- Definition of sources that manipulates the MIR: [`rustc_mir_build`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_build/index.html), [`rustc_mir_dataflow`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_dataflow/index.html), [`rustc_mir_transform`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_transform/index.html)
428-
- The Borrow Checker
429-
- Guide: [MIR Borrow Check](borrow_check.md)
430-
- Definition: [`rustc_borrowck`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_borrowck/index.html)
431-
- Main entry point: [`mir_borrowck` query](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_borrowck/fn.mir_borrowck.html)
432-
- `MIR` Optimizations
433-
- Guide: [MIR Optimizations](mir/optimizations.md)
434-
- Definition: [`rustc_mir_transform`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_transform/index.html)
435-
- Main entry point: [`optimized_mir` query](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_transform/fn.optimized_mir.html)
436-
- Code Generation
437-
- Guide: [Code Generation](backend/codegen.md)
438-
- Generating Machine Code from `LLVM-IR` with LLVM - **TODO: reference?**
439-
- Main entry point: [`rustc_codegen_ssa::base::codegen_crate`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/base/fn.codegen_crate.html)
440-
- This monomorphizes and produces `LLVM-IR` for one codegen unit. It then
441-
starts a background thread to run LLVM, which must be joined later.
442-
- Monomorphization happens lazily via [`FunctionCx::monomorphize`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/mir/struct.FunctionCx.html#method.monomorphize) and [`rustc_codegen_ssa::base::codegen_instance `](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/base/fn.codegen_instance.html)

0 commit comments

Comments
 (0)