Skip to content

Repository files navigation

mc

CI Site

A compiler small enough to read, written in itself.

mc compiles a schoolbook-C language — seven types, one opaque pointer, loop and if — into Mach-O for AArch64. A 2,846-line C23 seed is compiled by clang exactly once; after that mc compiles its own source, writes and signs the executable itself, and reaches a fixed point where one generation is byte-identical to the next. Everything the core leaves out — while, for, +=, a second backend, a whole object model — you teach it from ordinary mc source.

Build it

make stage0     # clang compiles the C23 seed, once and never again
make mc1        # the seed compiles src/mc.mc into the real compiler
make check      # tests, the fixed point, the taught-surface demos, the examples

build/mc1 --exe src/mc.mc -o mc writes the signed, ld-free compiler in one step. Released binaries are ad-hoc signed and not notarized, so a download needs xattr -d com.apple.quarantine mc once — see docs/ci.md.

Releases

Packages

Used by

Contributors

Languages