QPCC — an experimental C compiler written in Moonbit, supporting most of C23, C2Y, and a subset of GCC extensions.

QPCC — an experimental C compiler written in Moonbit, supporting most of C23, C2Y, and a subset of GCC extensions.

Its backend is qbe.mbt, a compiler backend project also implemented in Moonbit.

QPCC has successfully compiled QBE (a C project). It performed differential testing between the binary built by QPCC and the binary compiled from the same sources by Clang, passing all 58 out of 58 tests.

Experimental C2Y features implemented include named loops, _Countof, _Maxof, _Minof, and _Defer.

Upcoming roadmap: add _Atomic support, introduce a compiler syntax extension for _Tagged_union, and expand the test suite.

Limitations: support for K&R C and some obscure legacy syntax is incomplete.

Difference from mbtcc: mbtcc only targets C11, and it fails to build under the latest Moonbit compiler.

For the differential testing against Clang, were the 58 tests comparing only runtime behavior, or also diagnostics and exit codes for invalid programs? Compiler bugs often surface on error paths, so a negative-test set would make the comparison stronger. Also, how does _Defer interact with early returns and goto within the same scope?