Skip to content
HN On Hacker News ↗

Goeteia — a page that compiles itself

▲ 131 points • 22 comments • by guenchi • 4mo ago • HN discussion ↗

Pangram verdict · v3.3

We believe that this document is fully AI-generated

95 %

AI likelihood · overall

AI
0% human-written 100% AI-generated
SEGMENTS · HUMAN 0 of 2
SEGMENTS · AI 2 of 2
WORD COUNT 397
PEAK AI % 99% · §2
Analyzed
Jul 12
backend: pangram/v3.3
Segments scanned
2 windows
avg 199 words each
Distribution
0 / 100%
human / AI fraction
Verdict
AI
Pangram v3.3

Article text · 397 words · 2 segments analyzed

Human AI-generated
§1 AI · 94%

Everything beside this is rendered by Goeteia.The Scheme below is compiled to WebAssembly in your browser and mounted live.booting the compiler…The 3D title is a WebGL particle cloud — its glyphs, wave and colors are all in this source. Edit the dot-matrix rows, tweak the shader, press Run. This page carries the whole compiler (goeteia.wasm, ~70 KB gzipped, cached after first load); each recompile takes ~15 ms.What's insideSelf-hosting, to the byteThe compiler is written in the Scheme subset it compiles. The self-hosted build recompiles itself and the output is byte-identical — the fixpoint is checked in CI fashion on every change, and every test runs through both stages.Native Wasm GC objectsFixnums are unboxed i31refs, pairs and records are GC structs, eq? is one ref.eq. No shadow heap in JavaScript: the host supplies two byte-stream imports and nothing else.Hygienic macrossyntax-rules and procedural syntax-case with fenders, nested ellipses and datum->syntax, running in a compile-time interpreter with hygiene by renaming.Real closures, real tail callsTyped function references with a fast per-arity entry and a generic entry per closure — variadic procedures and apply are cheap, and every tail call is a return_call. A 100M-iteration loop runs in constant stack, in ~150ms.The numeric towerFixnums promote to bignums on overflow (checked inline, two bit-compares), flonums have contagion, rationals and complex are exact, and float literals are encoded to IEEE-754 by pure Scheme — so both hosts emit identical bytes.call/cc & dynamic-windEscape continuations ride the Wasm exception-handling proposal: capture is O(1), the normal path costs one try block, and winders unwind inner-to-outer on the way out.A reactive web stack(web sx) templates over fine-grained (web reactive) signals, an (web html) renderer, and a (web js) FFI that reaches straight into the host — this page is built with it.LibrariesR6RS-style (library ...) files with (import (math utils)) resolution, dependencies first; exports are advisory because unused code is pruned anyway.

§2 AI · 99%

Quick start$ git clone https://github.com/guenchi/Goeteia $ cd Goeteia $ ./run-tests.sh # every test, both compiler stages $ ./build-self.sh # rebuild the compiler with itself

$ echo '(define (fact n) (if (zero? n) 1 (* n (fact (- n 1))))) (fact 20)' > fact.ss $ node rt/compile.mjs goeteia.wasm fact.ss fact.wasm $ node rt/run.mjs fact.wasm 2432902008176640000Compiled modules run on any engine with Wasm GC and tail calls: Node 22+, current Chrome / Firefox / Safari, wasmtime. Bootstrapping from source needs Chez Scheme; the checked-in compiler wasm works without it.