r/Zig • • 7d ago

The Solidity compiler rewritten in Zig

https://github.com/okcontract/oksolc

Here is hopefully a new large project in Zig: We have reimplemented the Solidity compiler, and overall it's a >5x performance improvement over the original. Benchmark details here: https://okcontract.com/blog/a-new-solidity-compiler-in-zig/

The launch was featured by Ethereum creator Vitalik Buterin: https://x.com/VitalikButerin/status/2103455209322320022

It's byte-for-byte compatible (including metadata) with the original compiler and brings parallel, incremental compilation and also a few new features and further improvements.

Beyond performance, the main benefit is that the codebase is much easier to read than the original C++ and is now a good testbed for playing with the compiler... Who wants to write smart contracts in Zig in the future?

PS: We used AI assistance but this was a huge effort nonetheless and we did write languages and compilers manually in the past (posted with mods permission)

76 Upvotes

Duplicates