2 releases

new 0.1.20 Jan 12, 2025
0.1.19 Jul 13, 2024

#457 in Programming languages

Download history 12/week @ 2024-09-24 1/week @ 2024-10-08 2/week @ 2024-10-29 5/week @ 2024-11-05 6/week @ 2024-12-10 128/week @ 2025-01-07

128 downloads per month
Used in cyclang

Apache-2.0/MIT

160KB
4K SLoC

Cyclang

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);
}
print(fib(20));

You will need Rust installed to run the below command.

cyclang --file ./examples/fib.cyc

This should output 6765!

Installing and Running

You will need LLVM 19 installed before you install cyclang,

For MacOS run the following command

brew install llvm@19

For Ubuntu install the following packages

  llvm-19 
  llvm-19-tools 
  llvm-19-dev 
  clang-19 
  libpolly-19-dev

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.

Dependencies

~2.5–3.5MB
~73K SLoC