Skip to content

A small C compiler written in Rust, using LLVM as intermediate representation. Also includes a test bench.

License

Notifications You must be signed in to change notification settings

jlvoiseux/britten

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Britten

A C compiler written in Rust.

  • Implements both the frontend and the backend, with the LLVM IR as its intermediate representation
  • A test bench is included and is run in Github actions

Note: this is a work in progress and currently only supports compilation of int-only programs with unary operators, binary operators, and direct return values.

britten Screenshot 2025-02-09 153558

Prerequisites

  • Python3 (for the test bench)
  • Install Clang and lldb (used for preprocessing, linking, and for the test bench)

Usage

Tested on WSL2 only Preprocessing, executable generation from assembly code and linking are omitted for now. To compile a c file, do the following:

clang -E -P file.c -o file.i
./britten file.i
clang file.s -o file

Running tests

On the linux distribution of your choice:

cargo build --release --target x86_64-unknown-linux-gnu
python3 test/test.py

References

About

A small C compiler written in Rust, using LLVM as intermediate representation. Also includes a test bench.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published