Mica 6.12.6 is released for Linux x86-64 and AArch64. Its headline is one sentence: the compiler’s backend is now a product you can build your own compiler against. The Dragon SDK packages Dragon — the engine that turns an intermediate-code unit into native code — as a static archive and a C header. A front end written in any language emits Spectra, the intermediate language, and gets the same control-flow analysis, SSA middle-end, storage placement, register allocation, and native emission that compile Mica itself.
The Dragon SDK announcement tells the whole story — what the engine is, why we published it, and where it goes. This page is the release record: what shipped, what changed underneath, and what was fixed.
The focus points
- The Dragon SDK — the backend as its own package, behind one C header and one static archive.
- Two packages, two licences — the compiler stays free for every purpose; the SDK is free for noncommercial use, commercial use by agreement.
- Three intermediate-language additions — what a C front end needs: indirect calls, byte-counted pointer displacement, initialized writable globals with relocations.
- PL/0, twice — Wirth’s compiler written in C23 and in Mica against the shipped artifacts alone, as the SDK’s worked example.
- Ten defects fixed — building two whole compilers and fourteen tutorials against 6.12.5 found them; every one is fixed at the root.
The Dragon SDK
The mica-dragon-sdk package installs mica_dragon.h and
libmicadragon-<arch>.a. A consumer opens a session, asks the type registry
for its types, builds a unit with its symbol and address tables, appends
instructions, validates, and builds:
gcc -std=c23 -I /usr/include *.c /usr/lib/libmicadragon-<arch>.a -lpthread -o mycompilerValidation comes before emission on purpose. A front end that hands the engine a malformed unit meets a sentence naming the instruction and the rule it broke, rather than a crash inside register allocation.
From Mica, the same engine is one import away — no flag, no contract file, no
mica.project entry:
imp ContextNew, UnitNew, Validate, Build : dragon;The surface is embedded in the compiler binary, so a program compiles and diagnoses before any licence question arises; only the link asks for engine code.
Two packages, two licences
The compiler package mica is free for every purpose, commercial work
included — that does not change. The SDK is a separate download under the
PolyForm Noncommercial License 1.0.0:
free for research, teaching, personal study and hobby projects, with
commercial use by separate agreement. No SDK file rides inside the compiler
package or the container image, and the SDK has
a download page of its own so
nobody takes it without having read its terms.
What the intermediate language gained
Three additions, each chosen for what a C front end cannot express without it, each on both backends, each with validator rules that name a mistake instead of crashing later:
- An indirect call through a function address. C’s function pointers, vtables and callback tables lower directly. The indirect call reuses the direct call’s entire road — argument marshalling, the return, the failure channel — so no analysis had to learn a second shape.
- Byte-counted pointer displacement — GCC’s
POINTER_PLUS_EXPRverbatim, chosen over the scaled form because a scaled offset cannot be formed over a pointer to an incomplete type, and C’s self-referential struct is exactly that. - Initialized writable globals with relocations. A C file-scope initializer — including one whose value is the address of another global — becomes storage the linker fills in.
The worked example: PL/0, twice
The user container’s sdk/pl0/ holds Niklaus Wirth’s PL/0 — the smallest
complete compiler ever written down — twice: in C23 against the SDK’s header
and archive, and in Mica through the embedded dragon surface. Each twin is
seven units in one dependency order, each unit naming only units to its left,
so either compiler can be read a unit at a time. Each carries Wirth’s own
stack machine as its embedded oracle, and the two are certified against each
other by byte equality — same oracle output, same p-code listing, same
textual Spectra for every checked-in program.
The one place the twins diverge is the lesson: C spells the parser’s back-end seam as a struct of function pointers; Mica admits no function pointers at all, so its parser owns the dispatch. Same seam, same seven units, each language’s own idiom.
Fixed: ten defects in 6.12.5
Writing two whole compilers and fourteen tutorials against the shipped
compiler is the strongest adversarial review we know. It found ten defects —
six silent, two compiler aborts, one starved carrier configuration, one
unusable published surface. Every one is fixed at the root with regression
cases on both backends; the full table ships with the package —
apt changelog mica answers with the release’s whole story. The two worth a sentence
here: a library’s unit variable written by exactly one function lost its
store at every optimizing tier, and an exported record naming a type from a
sibling unit was published as unknown, which made the multi-unit road with
shared types unusable — both silent classes no user program had exercised
until the twins did.
The Learn series grew up alongside
Fourteen example-and-tutorial pairs shipped with this release window on the Learn page — values, memory, and concurrency, each tutorial built around a real compiled example from the tutorial repository, every output a real run, every refusal a compiled probe.
The stamp
The release gate ran whole on both architectures: 11,188/0 runs through the compiler binary, 11,093/0 through the legacy lowering path as a differential oracle, 11,093/0 under the race detector, plus the multicore and C-API gates. Install or upgrade from the install page.