0002. Write the bootstrap compiler in Rust
- Status: Accepted (revisit at M16.5)
- Date: 2026-10-29
- Plan: M0.4, M16.5
Context
The compiler must exist before Harness can compile itself. It will be written mostly by AI agents and read by people. It emits C, so the host language decides the compiler's own speed, correctness and distribution, not the speed of Harness programs.
Decision
Rust on the stable channel, edition 2024, no
unsafe, few dependencies, one Cargo workspace. The
compiler ships as one static binary, harness.
Alternatives considered
- C++ — Goose's choice, and agents write it well; weaker guardrails for a codebase many agents edit at once.
- Go — fast builds and easy distribution, but no sum types, which makes ASTs and IRs clumsy.
- OCaml — a classic compiler language with excellent pattern matching; a much smaller training corpus, so agents are less fluent.
- Python or TypeScript — fastest to prototype; slower compiles and a runtime to install.
- Zig — good C interop; younger, less stable, and fewer agents are fluent in it.
Consequences
Enums and pattern matching fit ASTs and IRs.
cargo test runs every test, including golden programs
and the C runtime's tests. CI needs only rustup and a C compiler.
Self-hosting is a separate decision at M16.5, made on measured
compile speed.