The archive · Product Ideas · Technical decision · 2019
Stage0: hand-typed hex programs bootstrap a C compiler from a seed binary under 1KB
Stage0 grows a full C toolchain from a hex program a human can type by hand, with every stage required to be readable by 70% of programmers.
Stage0
What it had to solve
Stage0's goal, in the README's own words, is 'creating a bootstrapping path to a C compiler capable of compiling GCC, with only the explicit requirement of a single 1 KByte binary or less' — for machines that have no firmware, operating system or other supplied software to start from. The author, Jeremiah (GitHub oriansj), had spent months hearing that a proper C compiler could not be written in assembly, and found no human-written C compiler in assembly to copy.
How it works
Stage0 attacks one of computing's hardest trust problems: how do you get a compiler when you can trust no existing compiler, firmware or operating system? Its answer is a constraint masquerading as madness — manually created hex programs whose only goal is a bootstrapping path to a C compiler capable of compiling GCC, starting from a single binary of 1 KByte or less. A Hacker News reader called it 'a wonderfully mad, cool goal.'
The design builds upward in auditable layers. A Hex0 monitor assembles hex programs typed by hand and provides minimal text input; stage one adds assemblers of growing power (Hex0, Hex1, Hex2) with comments, labels and addressing; a minimal macro assembler follows; and the first C compiler on the chain was written as a cross-compiler for x86 precisely so that everyone could verify what it did and watch it self-host. Two rules hold every step: the code must be understandable by 70% of programmers, and whether built manually or by automation, the resulting binaries MUST be identical.
The project grew out of the bootstrapping movement's worries about unverifiable toolchains — the thread that greeted it connected the work to escaping trusting-trust attacks and to preserving knowledge in forms that do not depend on today's compilers. The README credits its inspirations, from Edmund Grimley Evans's bcompiler and cc500 to Jonesforth, the PDP-1 'Expensive Typewriter', and a thought experiment about programming while stuck in a room; it also documents false starts the author kept in the repo for people who want to build the root binary independently.
The repository snapshot shows the chain reached stage three: a M2-Planet C compiler at version 1.0 with an x86 port, a dwarf-stub generator used in mescc-tools bootstrapping, and x86 tools that let builders verify programs for hardware they do not even own. Master hosting moved to GNU Savannah, POSIX ports cover x86, AMD64 and AArch64, and the stated future is more hardware ports plus implementing the Knight processor in FPGA and then TTL.
Why it lands
- Size and readability limits turn trust into an engineering property: a binary under 1KB that 70% of programmers can read is something a human can actually verify.
- Growing the chain in tiny stages meant each link was checkable, and a failed experiment (FORTH, Lisp) could be shelved without losing the whole project.
- Requiring byte-identical binaries from manual and automated builds gave a concrete proof that no stage secretly changed the code.
- Writing the first C compiler as an x86 cross-compiler let skeptics watch it self-host — answering the claim that a proper C compiler cannot be written in assembly.
- GPLv3 licensing and a GNU Savannah home tied the project to the free-software bootstrapping movement, turning a personal proof into shared infrastructure.
What it did
The June 2019 Hacker News post drew 200 points and 68 comments debating a 'world's smallest C compiler' and the trusting-trust problem; commenters called it a 'bootstrap pilgrimage'. The master repository now lives on GNU Savannah, the README's stage3 shows the M2-Planet C compiler used in mescc-tools-seed generation to 'complete the circle', and the repository snapshot shows 585 commits and 1.1k stars.
What you can take
To make something trustworthy, shrink the unverifiable part until a human can read it all: impose hard size and readability limits on the seed, then rebuild from that auditable point.
Since then
Stage0 remained an active reference project of the bootstrappable community: the README points to savannah.nongnu.org as the master repository, lists a GitLab mirror and a POSIX-port repository, and invites patches by email or on the #bootstrappable channel. The crawl snapshot shows 585 commits, 1.1k stars and 28 watchers on GitHub, with M2-Planet, blood-elf and mescc-tools-seed generation positioned as the path that 'completes the circle' from raw hex to a compiling toolchain. Launch discussion treated it as part of a wider push for trustworthy, bootstrappable systems.
Sources
- oriansj/stage0 — A set of minimal dependency bootstrap binaries
- Stage0 – A set of minimal C compiler bootstrap binaries (Hacker News discussion)
spotted an error? The archive wants to know.
Your turn
You just read one. Describe the brief you are staring at, and see who has been given the same problem.
Free account · 3 free questions · no card