{"slug": "show-hn-kcc-a-c-compiler-built-solo-with-an-llm-on-100-mo-boot-linux-kernel", "title": "Show HN: Kcc, a C compiler built solo with an LLM on $100/mo boot Linux kernel", "summary": "Cuauhtémoc Pacheco released kcc, a formal C17 compiler written entirely in ARM64 assembly as a single literate program using the weft metalanguage, co-authored with an AI collaborator (Claude) on a $100/month budget. The compiler checks C against the Standard, optimizes, allocates registers, emits native machine code, self-compiles to a byte-identical binary, cross-compiles to x86-64 on Linux and macOS, builds and runs Lua, SQLite and DOOM, and boots a Linux kernel. The roughly 1000-page book kcc.pdf is committed to the repository under an MIT license and is published as a GitLab Release asset.", "body_md": "**kcc** is a formal C17 compiler written entirely in ARM64 assembly, and set\ndown as a single **literate program** using [weft](https://github.com/temo-pacheco/weft),\na metalanguage built to be authored and read by human and AI collaborators\nalike. Every instruction is explained in prose before it is written in code.\n\nIt checks C against the Standard, optimises it, allocates registers, and emits\nnative machine code; it compiles itself to a byte-identical binary; and it\n**cross-compiles to x86-64** (Linux and macOS). It builds and runs Lua, SQLite,\nand DOOM — and boots a Linux kernel.\n\nThe whole book **is** the compiler (≈1000 pages): read\n**[kcc.pdf](https://github.com/LiterateDrivenDevelopment/kcc/blob/main/kcc.pdf)** in this repository, also published on\n[Releases](https://gitlab.polinesso.org/literate-programming/kcc/-/releases),\nor build it yourself (see below). Learn more about Literate Driven Development\nat [https://literatedriven.com](https://literatedriven.com).\n\nEverything the machine builds — the assembly modules, the verification scripts,\nand the `Makefile` itself — is **generated** by tangling the literate sources.\nYou never edit generated files; you edit the book.\n\n```\nkcc.weft          master document (LaTeX preamble + @i includes)\nliterate/         all the chapters (prose + code fragments)\nassets/           cover art (SVG → the PDF covers)\nkcc.pdf           the typeset book (committed; rebuilt with `make pdf`)\nREADME.md         this file\nLICENSE           MIT\n```\n\nThe typeset book, `kcc.pdf`, **is** committed, so the repository always carries\na readable copy of the current text. Rebuild it with `make pdf`.\n\nThere is a one-time bootstrap: because the `Makefile` is itself tangled from the\nbook, you generate it first, then use it.\n\n```\n# 1. Tangle sources, scripts, and the Makefile into gen/ (and ./Makefile).\nweft -p gen/ --mkdirs kcc.weft\n\n# 2. Build the compiler (gen/kcc).\nmake\n\n# 3. Compile something with it.\n./gen/kcc gen/hello.c -o gen/hello && ./gen/hello\n```\n\n`-p gen/` prepends `gen/` to every tangle output; `--mkdirs` creates the\ndirectories. The generated tree lives entirely under `gen/` (plus the root\n`Makefile`); `make clean` removes it and the command above regenerates it.\n\n| Target | What it does | \n|---|---|\n| `make` /`make build` | assemble + link `gen/kcc` | \n| `make difftest` | compile a corpus with kcc **and** clang, compare | \n| `make diagtest` /`make warntest` | invalid programs are rejected; `-Wall` warns | \n| `make test-codegen` /`make e2e` /`make interop` | run generated programs | \n| `make selfhost-*` | recompile a module in C with kcc, relink, verify | \n| `make meta-c` | full self-host fixpoint on Linux (needs Docker + qemu) | \n| `make ci` | the complete verification suite | \n| `make pdf` | weave the book and typeset `kcc.pdf` | \n\nThe verification scripts locate their own base directory, so they work under any\n`-p` prefix.\n\n`make pdf` weaves the `.weft` sources to `kcc.tex` and typesets `kcc.pdf` with\nLuaLaTeX. The covers are regenerated from `assets/*.svg` when `rsvg-convert` is\navailable. The resulting `kcc.pdf` is committed alongside the sources, so the\nbook can be read straight from the repository; tagged versions are also\npublished as a **Release** asset on GitLab.\n\n- **weft** ≥2.0.0  (the literate tool).\n- A C toolchain's `as` and`ld` (Xcode command-line tools on macOS).\n- For the book: a TeX distribution with LuaLaTeX and `latexmk` — a full[TeX Live](https://tug.org/texlive/) , or the lightweight[TinyTeX](https://yihui.org/tinytex/) (a minimal TeX Live) — and, optionally,`rsvg-convert` for the covers.\n- For `make meta-c` and the kernel-boot reproduction: Docker and qemu-user.\n\nMIT — see [LICENSE](https://github.com/LiterateDrivenDevelopment/kcc/blob/main/LICENSE). Copyright © 2026 Cuauhtémoc Pacheco, co-authored\nwith an AI collaborator (Claude).", "url": "https://wpnews.pro/news/show-hn-kcc-a-c-compiler-built-solo-with-an-llm-on-100-mo-boot-linux-kernel", "canonical_source": "https://github.com/LiterateDrivenDevelopment/kcc", "published_at": "2026-10-06 17:10:45+00:00", "updated_at": "2026-10-06 17:21:12.240584+00:00", "lang": "en", "topics": ["developer-tools", "artificial-intelligence", "large-language-models"], "entities": ["kcc", "Cuauhtémoc Pacheco", "Claude", "weft", "Lua", "SQLite", "DOOM", "Linux"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/show-hn-kcc-a-c-compiler-built-solo-with-an-llm-on-100-mo-boot-linux-kernel", "markdown": "https://wpnews.pro/news/show-hn-kcc-a-c-compiler-built-solo-with-an-llm-on-100-mo-boot-linux-kernel.md", "text": "https://wpnews.pro/news/show-hn-kcc-a-c-compiler-built-solo-with-an-llm-on-100-mo-boot-linux-kernel.txt", "jsonld": "https://wpnews.pro/news/show-hn-kcc-a-c-compiler-built-solo-with-an-llm-on-100-mo-boot-linux-kernel.jsonld"}}