DEV Community

Cover image for machin — a language optimized for the AI agent writing it, not the human reading it
Javier Leandro Arancibia
Javier Leandro Arancibia

Posted on • Originally published at github.com

machin — a language optimized for the AI agent writing it, not the human reading it

Every mainstream language was designed for human ergonomics: readable syntax, explicit types, multi-line formatting. That made sense when a human typed every character. But a lot of code is now written by LLMs — and there, every output token costs time and money, and most of that human-friendly ceremony taxes the writer without adding meaning.

machin (MFL) takes that flip seriously: it treats token cost as a first-class design constraint. Zero type annotations (everything inferred), one canonical declaration per line, whitespace tightened to the minimum that still parses. Then it compiles — through C — to a single static native binary. No VM, no interpreter, no GC pauses you'll notice.

The one-line pitch: write it like a script, ship it like C.

machin: a REST + SQLite service, compiled to a 40 KB native binary, running

▶ Try it in your browser — no install: play.intrane.fr. Write MFL, hit Run; it compiles to WebAssembly and runs client-side.

I didn't want to assert any of this, so I measured it — same programs, in the repo, runnable.

1. As cheap for an agent to write as Python

The same notes REST + SQLite API, written idiomatically in each language; tokens to author it (tiktoken o200k_base):

author tokens vs machin ships as
machin 388 1.00× 44 KB native binary, 0 deps
Python 383 0.99× source + a CPython interpreter
Go 527 1.36× 14.8 MB binary + a module dep

machin essentially ties Python on what it costs an agent to write — while being a compiled, statically-typed-by-inference native language. That's the whole trick.

2. In the native performance tier

Four compute kernels, byte-identical output across all three, each competitor at its best release setting (Rust -O3, Zig ReleaseFast, machin cc -O2), min of 5 (one machine):

kernel machin Rust -O3 Zig
fib(40) 245 ms 303 306
mandelbrot 1000² 827 814 819
sieve 10⁷ 203 153 145
intsum 10⁹ 2832 ms 3764 3556

machin wins two, ties one, and loses the array-heavy sieve by ~1.4×. It's C underneath, so on scalar recursion and integer loops gcc's optimizer matches or beats rustc/Zig here; on tight array indexing it trails. I'm not claiming "faster than Rust" — the sieve says otherwise. The claim is narrower and true: it's in the same tier, reached from Python-cheap source.

3. It ships like nothing in the scripting world

Same minimal HTTP server, four ways:

deployable image cold start idle RAM
machin (static, FROM scratch) 92.9 kB 0.49 ms 108 kB
Python 47.6 MB (512×) 49 ms (100×) 17.9 MB (166×)
Node 178 MB (1916×) 29 ms (59×) 51 MB (477×)

A 92.9 kB image — the binary and nothing else — verified serving traffic from a FROM scratch container. A real REST+SQLite service is ~1.2 MB (machin build --static compiles SQLite straight in). Either way: scp one file to a $4 VPS, or push a sub-megabyte image. No node_modules, no pip install, no 178 MB pull per cold node.

Is it a toy? I built a real thing with it

machin-hook — a self-hosted webhook relay + live inspector (think webhook.site + smee.io in one binary): capture any request, watch it land live in the browser over SSE, inspect / replay / forward it. ~330 lines of MFL, no Node, no framework. It's a dogfood, not a unicorn — but it's a genuinely deployable tool, not fizzbuzz.

Who it's for

A small, self-contained, deployable backend — a JSON API, a CLI, a webhook handler, a cron/daemon, an internal tool — where "one tiny binary, no Docker/Node/interpreter" is the actual win. And, increasingly, the language you point a coding agent at when you want a small service shipped cheaply.

Who it's NOT for (where I'd tell you to use something else)

  • An app that lives in an existing ecosystem (a Rails/Next/Django codebase, a team's Go services) — fit the tools they have.
  • Anything needing a specific mature library (a Stripe SDK, pandas, a game engine, ML). machin's stdlib is broad but shallow, and there is no package registry.
  • Data-science / numeric array-crunching — it trails ~1.4× there and lacks the libraries.
  • A team that won't run an unfamiliar language. machin is young — one author.

Status / honest caveats

Young project, one maintainer, pre-1.0, the API still moves. The stdlib is broad (HTTP server, SQLite + pure-MFL Postgres/MySQL/Redis/Mongo drivers, crypto, WebSockets, SSE, a WebAssembly UI target, a raylib game path) but shallow. TLS currently links OpenSSL, so HTTPS-terminating apps aren't FROM scratch yet (native TLS is in progress). It compiles via C, so building programs needs a C compiler.

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
Enter fullscreen mode Exit fullscreen mode

Then write app.src, machin encode framework/machweb.src app.src > app.mfl, machin build, run it.

I'd genuinely like to hear where the thesis breaks for you — especially the "agents write it cheaply" claim, since that's the bet the whole design makes.

Top comments (0)