michaelforney/cproc logo

michaelforney/cproc

Free

C11 compiler (mirror)

FreeFree tier
Type
Open Source

About michaelforney/cproc

cproc is a C compiler that uses QBE as its backend, released under the ISC license. It implements most of the C11 standard along with many C23 features and a few GNU C extensions. The compiler is written in standard C99 and can be built with any conforming C99 compiler. It aims to closely follow the C standard while remaining practical enough to compile many real-world software packages. Supported target architectures via QBE include x86_64, aarch64, and riscv64, with continuous testing on various Linux (musl/glibc), FreeBSD, and ARM/RISC-V environments. The project philosophy avoids implementing multiple C versions; instead, code must be updated to match new standards. An external preprocessor is required because cproc's built-in preprocessor is not fully implemented.

Key Features

Implements most of C11 and many C23 features
Uses QBE as compiler backend for efficient code generation
Written in standard C99 and can be built with any conforming C99 compiler
Supports x86_64, aarch64, and riscv64 target architectures via QBE
ISC licensed (permissive open-source license)
Inspired by other small C compilers like 8cc, c, lacc, and scc
Aims to closely follow C standard while being practical for real-world software

Pros & Cons

Pros
  • Strong focus on C standard conformance while remaining practical
  • Supports modern C features including C23
  • Small and lightweight codebase written in portable C99
  • Multi-architecture support via QBE backend (x86_64, aarch64, riscv64)
  • Permissive ISC license allows free use and modification
Cons
  • Built-in preprocessor is not fully implemented, requiring an external preprocessor
  • Does not support multiple C versions seamlessly; code may need adaptation for newer standards
  • May require small patches for non-conforming C code due to strict adherence to standards
  • Limited to architectures supported by QBE (currently x86_64, aarch64, riscv64)

Best For

Building and compiling C11/C23 software for x86_64, aarch64, or riscv64 systemsExperimenting with a minimal, standards-focused C compiler implementationLearning about compiler design through a small, readable codebaseCompiling real-world C packages that conform to modern C standards

FAQ

What C standards does cproc support?
cproc implements most of C11 as well as many C23 features. It also includes a few GNU C extensions.
What target architectures are supported?
All architectures supported by QBE should work, currently x86_64, aarch64, and riscv64. Continuous testing covers x86_64-linux-musl, x86_64-linux-gnu, x86_64-freebsd, aarch64-linux-musl, aarch64-linux-gnu, and riscv64-linux-gnu.
How do I build cproc?
Run ./configure to generate config.h and config.mk for your system. If your system is not supported by the configure script, you can create these files manually.
What external tools are needed at runtime?
You need QBE, an assembler, a linker, and an external preprocessor (since cproc's preprocessor is not fully implemented).
What license is cproc released under?
cproc is released under the ISC license, a permissive open-source license.