larmel/lacc
FreeA simple, self-hosting C compiler
About larmel/lacc
lacc is a simple, self-hosting C compiler written in C. It aims to compile itself and primarily targets x86_64 architecture, outputting GNU-style assembly, ELF object files, or preprocessed source. The compiler supports the C89 standard along with select features from later standards. It builds a rich intermediate representation using control flow graphs with basic blocks of three-address code, enabling basic dataflow analysis and optimization. The command-line interface is similar to GCC, accepting common flags such as -std=, -O levels, -g for debug info, and -D for macros. Recognized platforms include Linux (with glibc or musl) and OpenBSD. lacc also provides compiler-specific standard library headers for stddef.h and stdarg.h.
Key Features
Pros & Cons
- Self-hosting capability demonstrates correctness and completeness
- Simple codebase suitable for educational purposes
- Rich intermediate representation allows for basic optimization and analysis
- Command-line interface familiar to GCC users
- Supports commonly used C standards (C89) with some later features
- Limited to x86_64 architecture only
- Only fully targets Linux and OpenBSD platforms
- Primarily supports C89; later standards only partially implemented
- Described as a toy project, may not be suitable for production use
- No native AI or machine learning capabilities (not an AI tool)