8000 GitHub - lyledean1/cyclang: Compiler built in Rust using LLVM · GitHub
[go: up one dir, main page]

Skip to content
lyledean1Public

About

Compiler built in Rust using LLVM

Resources

Stars

29 stars

Watchers

1 watching

Forks

Repository files navigation

Cyclang

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!

Install

Quick Install (no LLVM required)

Download and install the latest prebuilt binary:

curl -fsSL https://raw.githubusercontent.com/lyledean1/cyclang/main/install.sh | bash

From source (LLVM required)

Install 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.

About

Compiler built in Rust using LLVM

Resources

Stars

29 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0