1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! The `Kaon` compiler pipeline.
//!
//! This module contains the entire compilation process, including lexing,
//! parsing, name resolution, typechecking and compiling into bytecode.
//!
//! # The Compiler Pipeline
//!
//! The following is a high level overview of how the compiler works.
//!
//! ## Lexing
//!
//! To begin with, user defined source code is transformed into a stream
//! of tokens. This is done through [`Lexer::tokenize`]. Any unrecongized tokens
//! are reported as syntax errors.
//!
//! ## Parsing
//!
//! The _parser_ generates an [`AST`] (abstract-syntax tree), from the token stream created
//! by the lexer. Parsing is done with a _recursive decent_ (top-down) parser.
//!
//! Any syntax errors are handled at this point.
//!
//! ## Name Resolution
//!
//! Names are resolved during this pass. The [`AST`] is transversed top-down and
//! any names it encounters (type names, variable name, etc.) are resolved.
//!
//! Duplicate names, undeclared variables, and other errors are reported during this pass.
//!
//! ## Typechecking
//!
//! During this pass, the _typechecker_ performs type inference and typechecking on the [`AST`].
//!
//! ## Code Generation
//!
//! This phase of the pipeline handles the actual process of coverting the high-level [`AST`] into
//! low-level bytecode, which resembles simplified machine code.
pub use ;
pub use Compiler;
pub use Lexer;
pub use Parser;
pub use Pass;
pub use ;
pub use ;
pub use ;