Skip to content
mc
Menu
Guide
Reference
Examples
Search the documentation
Guide
Getting started
One file, one program
A project: mc build and mc.toml
Teaching the compiler
Emitting bytes: sections, opcodes, passes and backends
Cross-compiling
Two worked examples
How mc compiles itself
Footprint
mc on a Linux host
mc on a Windows host
A new primitive
A new architecture — from "I have an ISA" to "my image boots"
Recreating the compiler
Run something you do not trust
Reference
#include <name>, the library inside the binary
Every command, flag and dump
Every message the compiler emits
The ten # directives
The parser and hook API
The core language
The machine task contract
The object model and the codegen API
mc sandbox — compile and run an arbitrary program in isolation
Sysroots — where a cross link finds its files
mc.toml, every key
Examples
Internals
Plan: mc — a self-hosting mini compiler, teachable via its surface
core-language.md — the .mc core language
surface.md — the teaching surface
build.md — mc build and mc.toml (M14), the bundle and #embed (M15), Linux targets (M16), Windows targets (M19/M20), limits (M23), a Linux host (M37), a Windows host (M38), the Linux executable (M42)
bootstrap.md — M8: cutting the cord (M11: cutting ld; M15: cutting the checkout)
determinism.md — the 8 rules of determinism
macho-notes.md — verified Mach-O/AArch64 notes
ci.md — the GitHub Actions workflows
Milestone specs
Spec M1 — lexer, token table, Pratt, AST, dumps, constant-expression codegen
Spec M10 — Tier 2: passes and backends taught through the surface
Spec M11 — direct executable (mc --exe), no ld
Spec M12 — Tier 3: syntax taught through code (syntax hooks), type aliases, #dylib,
Spec M13 (backlog) — sizing a program's memory at compile time
Spec M14 — project driver and mc.toml
Spec M15 — bundled standard library, #include <name>, #embed
Spec M16 — Linux arm64: ELF64 relocatable objects, Linux system layer, external linker
Spec M17 — machine interface split and the x86-64 machine (Linux x64)
Spec M19 — Windows arm64: COFF objects, a kernel32 system layer, lld-link
Spec M2 — locals, parameters, if/else, loop/break N/continue, calls, extern, local arrays, memory
Spec M20 -- Windows x64: COFF x64 relocations and the Win64 ABI on the x86-64 machine
Spec M21.5 — Tier 3 follow-ups exposed by examples/lang (mechanisms only)
Spec M21 - Tier 3 completion: expression/infix hooks, source record and replay, hygienic substitution
Spec M22 — examples/lang: a higher-level language taught to mc by a prelude
Spec M23 — dynamic limits: best-effort sizing with a tolerance, no hard caps
Spec M24 -- Tier 4: primitives and hardware instructions taught from the surface
Spec M25 -- sysroots and cross-compilation resolution
Spec M26 — the documentation set
Spec M27 — site/: a static site generator written in mc, the layout and the icon
Spec M28 - mc lsp: the taught compiler as language server
Spec M29 — VS Code extension (editor/vscode)
Spec M3 — globals, global arrays, strings, #include, #define, arena, data sections
Spec M30 — debugging: DWARF emission and lldb-dap
Spec M31 -- concurrency taught by a module: spawn, intent, await
Spec M32 — examples/desktop: composing windows with GTK4 from mc (owner's test, 2026-09-03)
Spec M33 -- WebAssembly: an AST-consuming backend, <sys/wasi>, <sys/browser>, examples/wasm
Spec M34 — examples/minimal: the smallest executable and what it costs (owner, 2026-09-03)
Spec M35 — benchmark tooling (owner, 2026-09-03)
Spec M36 — multi-target builds (owner, 2026-09-03; last in the queue)
Spec M37 — mc hosted on Linux (owner's need, 2026-09-04: the cloud only runs Linux)
Spec M38 -- mc hosted on Windows (arm64 and x64)
Spec M39 -- an architecture taught from the surface: examples/kernel, a bare-metal RISC-V 64 micro-kernel built by a taught compiler
Spec M4 — tokenizer in .mc (a free cross-check)
Spec M40 -- the narrow word: examples/avr, a bare-metal ATmega328P image built by a taught compiler
M41.5 — a module can participate in a function's parameter list
Spec M41 -- override, debloat and re-arch: <mc/core> becomes composable, and a recreated compiler is smaller than mc by what it omits
Spec M42 -- --exe on every host: the ELF executable writer, dynamic first
Spec M43 -- the sandbox: compile and run an arbitrary mc program in isolation (Layer 1, now), and the web playground it makes possible (Layer 2, post-1.0.0, priced only)
Spec M44 -- packages: source distribution, Go-style, from a registry of sources
Spec M45 -- i32, and a call returns what it declares
Spec M5.5 — fixes from the M3/M5 reviews + core pieces M6 needs
Spec M5.6 — fixes from the M5.5 review + creat (found during M6-macho)
Spec M5 — #section, #opcode, emit(), reloc(), sys.mc via svc
Spec M6 — src/mc.mc: the self-hosted compiler · Spec M7 — fixed point
Spec M9 — #rule (surface piece C) + lib/prelude.mc
Examples
This section has no pages yet.
← Previous
mc.toml, every key
Next →
mc documentation