Internals
These pages are for people working on Bolt itself. Each page answers one question, and that decides where it is:
- Compiler: how a stage of the compiler works.
- Designs: why a feature of the language is the way it is, with what was considered instead and what's still to decide.
- Tooling: how packages are found and the compiler is run.
- Proofs: the Lean proof of the mutability rules, what it covers, and how it links to Bolt.
A design that isn't fully built yet says so in a box at its top, so pages don't move when they're implemented.
The compiler
A program goes through these stages, each a crate in crates/:
| Stage | Crate | Pages |
|---|---|---|
| Lexing and parsing into a lossless tree | boltlang-parser, boltlang-syntax | Syntax |
| Definitions, name resolution and bodies | boltlang-hir-def | Definitions and names |
| Type checking | boltlang-hir-ty | Type checking |
| Building MIR, with patterns as decision graphs | boltlang-mir-build, boltlang-pattern | MIR |
| Passes over MIR, like desugarings and shims | boltlang-mir-transform | MIR |
| Monomorphization | boltlang-mir-mono | MIR |
| Lowering to Conduit | boltlang-codegen-conduit | Conduit |
Conduit, the IR that Bolt compiles to, is a project of its own. It runs programs in an evaluator and compiles them to WebAssembly.
Around the stages:
boltlang-base-dbis the base of the Salsa database, with files and their syntax trees. Every stage is made of queries on it, so the language server only redoes what an edit affects.boltlang-hiris the semantic model of a program for tools, andboltlang-ide-diagnosticsturns what the stages report into diagnostics with a code, a severity and a message.bolt-language-serverandbolt-language-server-wasmare the language server, natively and in the browser.boltlang-cliis theboltcommand.boltlang-stdholds thestdpackage (see Packages), andboltlang-corpusthe format of the test files intests/.
Designs
| Design | Status |
|---|---|
| Mutability | implemented |
| Parameter names | implemented |
| Effects | checked and run; some of it is still to decide |
| Async | partly: tasks and an executor in std |
| Reactive UI | a proposal |