About rui314/8cc
8cc is a small, self-hosting C compiler designed to support all C11 language features while keeping the codebase as concise and readable as possible. Created by Rui Ueyama, it serves as educational material for learning compiler techniques, including lexing, preprocessing, and parsing. The compiler is capable of compiling itself (self-hosting) and includes unit tests. However, it is no longer actively developed (successor: chibicc), only targets x86-64 Linux, and is not an optimizing compiler—generated code is typically 2x or slower than GCC. It is best suited for study and experimentation rather than production use.
Key Features
Self-hosting (can compile itself)
Supports C11 language features
Concise and readable source code for educational purposes
Includes unit tests (make test)
Builds with simple make-based toolchain
Lexer, preprocessor, and parser clearly implemented
Pros & Cons
Pros
- Self-hosting demonstrates compiler maturity
- Clean, well-commented codebase ideal for study
- Supports modern C11 standard
- Unit tests help verify correctness
Cons
- No longer actively maintained (successor: chibicc)
- Only targets x86-64 Linux, not portable
- Not an optimizing compiler; generated code is 2x+ slower than GCC
- May produce compile errors or miscompilations for programs other than itself
- Limited to personal/hobby project level of reliability
Best For
Learning C compiler internals and programming language implementationStudying lexical analysis, preprocessing, and parsing techniquesEducational reference for small compiler designExperimental C11 development on x86-64 Linux
FAQ
What is 8cc?
8cc is a small C compiler that supports C11 and is designed to be self-hosting and educational.
Is 8cc still actively developed?
No, 8cc is no longer an active project. Its successor is chibicc.
What platforms does 8cc support?
8cc supports x86-64 Linux only. There are no plans to make it portable until all known miscompilations are fixed and an optimization pass is implemented.
Is 8cc an optimizing compiler?
No, 8cc is not an optimizing compiler. Generated code is typically 2x or slower than GCC.
Who developed 8cc?
8cc was developed by Rui Ueyama (rui314@gmail.com).