A Rust implementation of a C compiler for a small language subset, inspired by Nora Sandler's C Compiler book.
- Rust (1.70+)
- GCC
Note: On Mac with Apple Silicon, the compiler generates x86_64 code. Run
arch -x86_64 zshbefore running tests or compiled binaries.
# Compile a C file
./fcc program.c
# Help
./fcc --helpcargo build --releaseRun the test suite by running:
bash scripts/tests.sh # runs both unit and compliance tests
# or
bash scripts/tests.sh --unit # runs unit tests
# or
bash scripts/tests.sh --compliance # runs compliance tests
# or
bash scripts/tests.sh --compliance --chapter 8 # runs compliance tests starting from chapter 8
- Chapter 1-8: Loops
- Chapter 9: Functions