How Our Rust-to-Zig Rewrite Is Going
The team behind the Roc programming language has reached feature parity after a 487-day project to rewrite their compiler from Rust to Zig. This milestone allows for more efficient WebAssembly output and marks a significant step toward their upcoming 0.1.0 release.
Why it matters
Compiler development is a foundational aspect of software engineering, and this rewrite highlights the ongoing trade-offs and technical preferences between modern systems programming languages.
For the past year and a half, the team building Roc 's compiler has been rewriting our 300,000 lines of Rust code into Zig , for reasons I'll recap below. We recently passed an exciting milestone: feature parity with the original compiler!
Since the Bun project recently shared an experience report of their rewrite in the other direction (from Zig to Rust, although that's only the tip of the iceberg of differences between our rewrites), this seems like a nice time to reflect on how our move from Rust to Zig is going.
Hitting this milestone made it possible to update Brendan Hansknecht 's charming 2024 WASM-4 game, Rocci Bird (with art by Luke DeVault) to use the new compiler. It's a nice example because the whole game is under a thousand lines of Roc code, and you can play it on itch.io or right here via WebAssembly :
Get smarter about the news
Sign up free for a feed built around what you actually care about, Dive Deeper research on any story, and the full text of every article.
Create free accountAlready have an account? Sign in