About rui314/chibicc
chibicc is a small C compiler that implements most C11 features, including preprocessor, floating-point types (float, double, long double using x87 80-bit), bit-fields, alloca, variable-length arrays, compound literals, thread-local variables, atomic variables, common symbols, designated initializers, wide string literals (L, u, U, u8), and functions passing/returning structs by value per x86-64 SystemV ABI. It is capable of compiling real-world programs such as Git, SQLite, libpng, and itself without modifications, and the generated executables pass their respective test suites. The compiler is developed as a reference implementation for an upcoming book on C compiler and low-level programming, with each commit corresponding to a section in the book, enabling incremental learning. chibicc is licensed under an open-source permissive license and is available on GitHub.
Key Features
Pros & Cons
- Small codebase with readable commits for educational purposes
- Supports a wide range of C11 features often missing in toy compilers
- Can compile real-world, complex C programs like Git and SQLite
- Actively maintained as part of a book project with clear documentation
- Free and open source under a permissive license
- Does not support complex numbers, K&R-style function prototypes, or GCC inline assembly
- Digraphs and trigraphs are intentionally not supported
- Targets only x86-64 Linux (limited platform portability)
- Still considered a 'toy compiler' compared to GCC or Clang for large-scale production use