#llvm #pest #language #wasm

app cyclang

Cyclang is a toy language built in LLVM

8 releases

0.1.18 Jan 7, 2024
0.1.17 Nov 17, 2023
0.1.15 Oct 22, 2023

#74 in Programming languages

Download history 11/week @ 2023-10-28 38/week @ 2023-11-11 36/week @ 2023-11-18 17/week @ 2023-11-25 16/week @ 2023-12-02 7/week @ 2023-12-16 14/week @ 2023-12-23 1/week @ 2023-12-30 39/week @ 2024-01-06 2/week @ 2024-01-13 25/week @ 2024-01-27 8/week @ 2024-02-03 28/week @ 2024-02-10

61 downloads per month



Contains (Mach-o exe, 34KB) bin/main


A programming language I built in Rust - mainly for fun and my own learning! Uses PEG Parser in Rust for parsing and LLVM (llvm-sys) as the backend to compile to machine code binary. Check the user guide for a detailed overview of the language.

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);

You will need Rust installed to run the below command.

cyclang --file ./examples/fib.cyc

This should output 6765!

WebAssembly (WASM)

To run the WASM example that compares Cyclang output (and an optimised version of the IR) against JS use the following command:

make fib-wasm

Below is a comparison of times in Node, Cyclang (unoptimized) WASM and Cyclang optimized WASM for a simple Fibonacci example.

Screenshot 2023-11-17 at 18 08 23

Ensure you have wasm-ld installed to convert LLVM object IR to a .wasm file. This should come with the LLVM 17 installation - instructions below.

Installing and Running

You will need LLVM 17 installed before you install cyclang,

For MacOS run the following command

brew install llvm@17

For Ubuntu install the following packages


And run make set-llvm-sys-ffi-workaround

Then the easiest way to install the binary currently is through the Rust package manager Cargo - see Install Rust. Once the step above is done, then run

cargo install cyclang

See the book for a more detailed guide on setup.


~192K SLoC