Cyclang is a small programming language implemented in Rust. It parses with a PEG parser and compiles to native machine code via LLVM. See the user guide for the language overview.
Try the Fibonacci example in /examples/fib.cyc
fn fib(i32 n) -> i32 {
if (n < 2) {
return n;
}
return fib(n - 1) + fib(n - 2);
}
print(fib(20));You will need Rust installed to run the below command.
cyclang --file ./examples/fib.cyc
This should output 6765!
Download and install the latest prebuilt binary:
curl -fsSL https://raw.githubusercontent.com/lyledean1/cyclang/main/install.sh | bashInstall LLVM 21 first.
MacOS:
brew install llvm@21
Ubuntu packages:
llvm-21
llvm-21-tools
llvm-21-dev
clang-21
libpolly-21-dev
Then run make set-llvm-sys-ffi-workaround.
Install with Cargo (requires Rust): Install Rust. Once LLVM is set up, run:
cargo install cyclang
See the book for a more detailed guide on setup.