Skip to content

Latest commit

 

History

History
33 lines (27 loc) · 1.39 KB

README.md

File metadata and controls

33 lines (27 loc) · 1.39 KB

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