v0.106.0 · the compiler now compiles itself

machin ⎯ MFL

A language optimized for the AI agent writing it, not the human reading it.
As terse as Python to write, compiled through C to a tiny native binary. Write it like a script, ship it like C.

🧬 machin compiles itself. The machin compiler (lexer → parser → type-checker → C codegen) is now written in machin, and it emits the same machine code as the original compiler byte-for-byte. It even compiles its own source into a native binary that re-emits itself identically — a genuine compiler fixpoint — at ~0.9× the original's speed. See how →
machin: a REST + SQLite service, compiled to a tiny native binary, running

A whole REST + SQLite service → a native binary → serving, in ~20 seconds.

Measured, not asserted

The same programs, written idiomatically in each language — all runnable under bench/ in the repo.

1 · As cheap for an agent to write as Python. Tokens to author the same REST+SQLite API (tiktoken o200k):

languageauthor tokensships as
machin38844 KB native binary, 0 deps
Python383 (0.99×)source + a CPython interpreter
Go527 (1.36×)14.8 MB binary + a module dep

2 · Native-tier fast. Four kernels, byte-identical output, each at its best release setting (min of 5):

kernelmachinRust -O3Zig
fib(40)245 ms303306
mandelbrot 1000²827814819
sieve 10⁷203153145
intsum 10⁹2832 ms37643556

It's C underneath — wins scalar recursion + integer loops, ties float, trails ~1.4× on array-heavy code. In the same tier as Rust/Zig; not "faster than Rust".

3 · Ships like nothing in the scripting world. Same HTTP server, deployed:

same serverimagecold startidle RAM
machin (static, FROM scratch)92.9 kB0.49 ms108 kB
Python (py + alpine)47.6 MB · 512×49 ms · 100×17.9 MB · 166×
Node (js + alpine)178 MB · 1916×29 ms · 59×51 MB · 477×

A 92.9 kB image, ready in half a millisecond, on ~0.1 MB of RAM. scp one file to a $4 VPS.

Try it (~60 seconds)

curl -fsSL https://raw.githubusercontent.com/javimosch/machin/main/install.sh | sh
machin guide                                # the whole language, version-exact, as JSON

# write app.src (a REST+SQLite service), then:
machin encode framework/machweb.src app.src > app.mfl   # framework ships in the binary
machin build --static app.mfl -o app                    # static (musl) → FROM scratch
./app

Building programs needs a C compiler. machin build <file> --emit-c prints the C the compiler generated.

Batteries included — pure MFL, one binary

HTTP + router

machweb: a native server, JSON, cookies, signed sessions, SSO, SSE, WebSockets.

Databases

SQLite built in (bundled with --static); pure-MFL Postgres / MySQL / Redis / Mongo drivers, pooled.

Concurrency

goroutines, channels, select; a per-goroutine arena plus scoped arena{ } blocks that bound a long-lived loop's memory.

Closures

func literals capture by reference — mutable state across calls, the counter idiom, no boilerplate.

--safe mode

opt-in bounds, div-zero, and overflow checks for when you want guardrails over raw speed.

Crypto

SHA-256, HMAC, HKDF, Ed25519, X25519, AES-GCM — binary and text paths.

Frontend & games

a reactive WebAssembly UI target; raylib GUI/audio/3D via C FFI.

One artifact

compiles to a single native binary — no Node, no interpreter, no runtime.

Built with it

machin-hook — a self-hosted webhook relay + live inspector (webhook.site + smee.io in one binary): capture any request, watch it land live over SSE, replay or forward it. ~330 lines of MFL. The curated list of tools is awesome-machin.