Compiler Architecture (Seed Reality)
HTML reading page generated from the source Markdown document.
Reading mode
This page is the static HTML reader for compiler/architecture.md. Internal Markdown links are rewritten to HTML when a matching reading page exists.
Compiler Architecture (Seed Reality)
This document describes what the current seed compiler actually does.
Overview
The current compiler architecture is organized around a deterministic driver, a frontend and analysis pipeline, a checked HIR to MIR lowering path, and one working backend. The goal of this page is not to describe an idealized future compiler, but to document the contract that contributors can rely on in the current repository state.
| Area | Current contract |
|---|---|
| Entry point | toolchain/seed/vittec0.seed |
| Driver | explicit command surface with stable modes |
| Frontend | registry, module graph, symbols, visibility, type DB |
| Analysis | HIR validate, sema, typeck, control-flow, borrowck |
| Lowering | HIR -> MIR, MIR verify, const-eval |
| Backend | C backend plus host object/link toolchain |
| Diagnostics | cataloged codes, text or JSON output |
- Front door:
toolchain/seed/vittec0.seed. - Modes:
check,build,run,test,dump-*,self-check. - Core pipeline in
check:registry -> module graph -> symbol/visibility -> type-db -> HIR validate ->sema -> typeck -> control-flow -> borrowck -> HIR->MIR -> MIR verify ->const-eval. - Backend: one functional backend (
C), then object/link using host toolchain. - Diagnostics: cataloged codes only, JSON or text.
Responsibilities
This page owns the high-level architecture map:
- where the driver begins and ends,
- which phases are part of the enforced seed reality,
- which foundation tracks are already wired into the pipeline,
- which supporting specs should be consulted for narrower subsystems.
Invariants
- The documented entry remains
toolchain/seed/vittec0.seed. - The checked pipeline order must stay deterministic.
- Driver and diagnostics contracts stay explicit rather than hidden behind fallback behavior.
- Narrow subsystem specs may evolve, but they must not silently contradict this architecture page.
Data Flow
The real compiler flow currently looks like this:
- CLI entry selects a driver mode.
- Registry and module graph determine the project surface.
- Frontend analysis builds symbols, visibility, and type database state.
- HIR validation and semantic checks confirm structural correctness.
- Type checking, control-flow, and borrow checking validate program contracts.
- HIR lowers to MIR, MIR is verified, and constants are evaluated.
- Backend lowering produces object files and then links with the host toolchain.
Bootstrap
Bootstrap is part of the architecture contract because the compiler is audited through a reproducible seed trust root and explicit compiler generations, not just through source organization.
- Bootstrap overview
- Bootstrap seed
- Bootstrap generations
- Bootstrap reproducibility
- Bootstrap self-host checks
- Bootstrap troubleshooting
- Bootstrap seed contract
- Bootstrap native IR contract
Driver
The driver is intentionally visible in the architecture because it defines the user-facing command boundary and CI audit surface.
Foundation Status (170-173)
170 MACRO EXPANSION PIPELINE- Frontend pipeline includes macro expansion with trace and diagnostics.
- Macro diagnostics are mapped to frontend spans (
line,column,width). - Recursion safety foundation is enforced via expansion limit diagnostics.
- Detailed spec:
- macro_expansion_pipeline.md
171 ASYNC FOUNDATION- HIR lowering tags async/await usage at item level.
- Baseline async misuse diagnostic is emitted for
awaitoutside async procedures. - Detailed spec:
- async_foundation.md
172 COROUTINE LOWERING- MIR lowering introduces suspension/resume control-flow blocks when await-like expressions are present.
- This provides a first state-machine skeleton for future generator lowering.
- Detailed spec:
- coroutine_lowering.md
173 CONCURRENCY MEMORY MODEL- Foundation spec documented in:
- concurrency_memory_model.md
Roadmap links (161-200):
Examples
Un développeur qui souhaite vérifier un module utilise la commande check du compilateur seed :
./toolchain/seed/vittec0.seed check src/app.vit
Ce mode exécute les étapes principales du frontend et du pipeline de validation sans produire d'objet exécutable.
checklance la résolution de module, la validation HIR, la vérification sémantique et le borrow check.- L'étape backend est ignorée sauf pour les diagnostics qui nécessitent l'abaissement.
Reference Map
Compiler subsystem references:
- Pipeline
- Type system
- Borrow checking
- MIR
- Diagnostics
- Diagnostics migration
- Backend
- Standard library contracts
- Sanitizers
- Security limits
- Stress and stability
- Advanced optimization passes
- Parallel borrow analysis
- LLVM backend experimental notes
- Native ASM backend
- Migration and editions
- Compiler power roadmap
- Macro expansion pipeline
- Async foundation
- Coroutine lowering
- Concurrency memory model