An experimental compiler backend with a similar approach as llvm but trying to be more modular, simpler and overall more intuitive.
Citadel: A bastion to protect from the dragon :p
Citadel is designed to be self-hosted, meaning you do not need to install anything besides the rust crates. Infact, Citadel itself is only an api that allows developers to create optimizer, backends and of course their compiler.
The mission of this project is to empower more people to build compilers and for making rust a better option for developing them. Let the compiler wars begin :p
-
Install Rust, Citadel-Dev-Tools and (Optional) Python minimum py-version: 3.12
-
Try building the repository using
cargo build
in thecitadel
root folder -
(Optional) Run the tests using
python scripts/tests.py all
-
Api - The api thats exposed to the developer. Has lots of qol features and bundles all 3 ends so the developer doesn't need to interact with these directly.
-
Frontend - Frontend for citadel that helps with generating IR from your source code
-
Middleend - Middleend for citadel that optimizes source code and generates multiple more low-level IRs from this depending on the optimization level
-
Backend - Backend that compiles IR to machine-code
-
IrParser - a parser for tokenizing and parsing IR into valid IR statements as specified in the frontend. This is also used for ciri and the engine
-
Test-lang For testing, experimenting and providing an example on how to build a compiler with citadel
-
Engine - a simple compiler implementation for compiling IR to a specified backend. Uses IRParser to parse the IR.
-
Citadel-Dev-Tools - tools that are needed when developing the citadel toolchain, the backend in particular