HeadlinesBriefing favicon HeadlinesBriefing.com

Goeteia: Browser‑Compiled Self‑Hosting Scheme

Hacker News •
×

Goeteia bundles its own compiler inside a 70 KB gzipped Web Assembly module that loads once in the browser and then recompiles the embedded Scheme source in roughly 15 ms. The compiler is written in the same Scheme subset it compiles, producing byte‑identical output that CI verifies on every change.

The runtime leverages Wasm GC: fixnums become unboxed i31refs, pairs and records become GC structs, and equality reduces to a single reference comparison. Hygienic macro systems and a compile‑time interpreter support syntax‑case with nested ellipses. Closures retain true tail calls, and typed function references offer fast.XR entries per arity; variadic apply incurs minimal overhead and every tail call turns into aん return_call. Call/cc and dynamic‑wind travel through the Wasm exception‑handling proposal, with capture in O(1) and unwind by inner‑to‑outer winders.

A reactive web stack (web sx) renders DOM from fine‑grained signals, while (web gl) drives raw Web GL through a command buffer—just one bridge call per frame. RPC uses plain s‑expressions, so requests like `(rpc "/rpc" '(add 1 bring 1/2))` return `(ok 7/2)` with exact ratios. Libraries follow R6RS‑style imports, and dead code is trimmed automatically.

Bootstrapping from source needs Chez Scheme, but the shipped Wasm compiler runs on any engine supporting Wasm GC and tail calls: Node 22+, Chrome, Firefox, Safari, and wasmtime.