Skip to the content
Diaspar

Decision D012 · superseded

The phase-0 bootstrap interpreter is written in Rust

A record of the language's design, as it stood on 2026-11-18: written for the people who build Diaspar, and kept as it was written. Its code is a sketch, not a program of the site, and an older record may show syntax that a later one changed. It names files of the language's source, which is not public yet.

Status: superseded (2026-11-18): its phase is over. The compiler written in Diaspar compiles itself, building Diaspar needs only a C compiler and the seed (D003, docs/design/self-hosting.md), and the interpreter is deleted, as this decision planned; its last commit is tagged last-rust-interpreter. Accepted 2026-11-15; the text below is as it was.

Decision

Phase 0 of the bootstrap is a throwaway interpreter written in Rust, in bootstrap/ (the crate diaspar-boot). It runs the first Diaspar code until the interpreter and compiler written in Diaspar (D003) can replace it; then it is deleted.

The first milestone is a minimal live Diaspar:

  • the reader with Racket-style brackets that preserves bracket shape (D008);
  • the core forms def, fn, let, if, do, loop/recur, quote;
  • a REPL where redefining a global is seen by existing code, through cells (D003);
  • defmacro, with defn as a macro over def and fn (D009).

Records and protocols (D010), modules (D011), and stage-1 effects (D005) come next, in that order.

Why Rust

  • The author and coding agents know it best.
  • It does not impose its own semantics on Diaspar: unlike a Scheme host, it has no garbage collector, continuations, or macro system that could leak into the design.
  • Reference counting with copy-on-write is natural in it (Rc::make_mut), which mirrors Perceus reuse (D004).

Rejected alternatives

Host Why not
Chez Scheme or Racket A small interpreter, but the host's semantics (tracing GC, continuations, hygiene) easily leak into Diaspar
Ferron Brings Ferron's heavy toolchain, which Diaspar is leaving
C Closest to the future C backend, but slower to write and easy to get memory wrong

Rules

  • The host interpreter is throwaway: keep it small and clear, not fast.
  • It implements only what the decisions settle. Questions it raises go back to decisions, not into the interpreter.
  • Diaspar code it runs must not depend on host-only behaviour, so the same code later runs on the Diaspar implementation.