Crazy idea time ...
Could we (at least in theory maybe) add zig's AIR as a compiler target, and then use the zig compiler as a backend?
From Zig Sema: ZIR => AIR
AIR, which stands for “Analyzed Intermediate Representation” is a fully typed intermediate representation, whereas ZIR is an untyped intermediate representation. AIR can then be lowered directly to machine code.
Why might we want to do this?
The zig compiler is going to be really fast, and target a lot of different platforms including producing LLVM IR.
The zig team are doing a lot of engineering on thier IR's. For example they can be dumped to disk.
I thought I heard or read somewhere that the zig team would like thier IR's to be used by other projects, but I can't find that now.
Could this mean we remove LLVM?
Why this might be a bad idea?
We are coupled to the zig compiler, which is changing fast. Note that LLVM also changes between versions, and so there are always changes to keep in sync there too.
We are adding another compiler/dependency.
If only roc was written in Zig, that would make exploring this a lot easier...haha
Instead, I assume we would have to maintain rust to zig bindings via cffi and that likely would be kinda a mess.
Anyway, definitely and intriguing idea, but no real thoughts about it. Like if someone knew air and wanted to do this, it would be interesting. I would guess it would be too much of a moving target and dependency complication, but idk.
Last updated: Jun 16 2026 at 16:19 UTC