Skip to content
/ fcc Public

A compiler of a tiny C subset, written in Rust.

Notifications You must be signed in to change notification settings

fedejinich/fcc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

332 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fcc

A Rust implementation of a C compiler for a small language subset, inspired by Nora Sandler's C Compiler book.

Requirements

  • Rust (1.70+)
  • GCC

Note: On Mac with Apple Silicon, the compiler generates x86_64 code. Run arch -x86_64 zsh before running tests or compiled binaries.

Usage

# Compile a C file
./fcc program.c

# Help
./fcc --help

Build

cargo build --release

Test

Run 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

Progress

  • Chapter 1-8: Loops
  • Chapter 9: Functions

About

A compiler of a tiny C subset, written in Rust.

Resources

Stars

Watchers

Forks

Packages

No packages published