This is a hobby C compiler written from scratch in Rust that emits x86_64 assembly compliant with System V ABI. This ongoing project aims to support the majority of C89/90 features.
Currently, you can either provide the raw C code as the first argument or pass the path to the file you want to compile:
cargo run examples/singlenum.c
The entire test suite can be executed by
cargo test
.
All of the development and testing have taken place on an Ubuntu 18.04 VM.
- Preprocessor
- Floating point arithmetics
- Type casting
- Replace the lexer with a DFA-based implementation
The nature of this project being educational, the codebase is quite lax on error checking.
On another note, I decided not to support obsolete features such as the following:
- Trigraphs
- K&R style declarations and definitions
- Function declarations without a prototype
In the earliest stage of development, I mainly referred to this book. In addition to the normative reference which is the standard itself, I have also referred to the Dragon Book, from which I gained a lot of design insights.