v0.2.0 Released — Now Self-Hosting

The language
that compiles itself

Rey is a compiled language with a clean syntax and strong type system. Fast like Rust, readable like Python, and its compiler is written in itself.

$curl -fsSL https://get.reylang.dev | sh
main.rey
600;">func greet(name: String): String {
    600;">return "Hello, " + name + "!";
}

600;">func main(): Void {
    println(greet("Rey"));

    600;">var nums = [1, 2, 3, 4, 5];
    600;">var doubled = nums.map((x) => x * 2);
    println(doubled.join(", "));
}
Hello, Rey!
2, 4, 6, 8, 10
v0.2.0
Latest Release
11
E2E Tests Passing
macOS arm64
Primary Platform
MIT
License

Built for real programs

Rey combines the performance of a systems language with the clarity of a scripting language. No compromises.

Native Speed

Compiles directly to native machine code via LLVM. Zero GC pauses, predictable performance, and tiny binaries.

🔄

Self-Hosting Compiler

The Rey compiler is written in Rey itself. v0.2.0 achieved full self-hosting — a major milestone in the language's maturity.

Clean Syntax

Expressive and readable. Functions, structs, enums, pattern matching, and lambdas with no boilerplate.

🔒

Strong Types

Fully inferred type system. Annotate when you want enforcement, omit when the compiler can figure it out.

📦

Modern Stdlib

Vec, HashMap, Result, Option, file I/O, and string utilities built-in. No external dependencies needed.

🎯

Simple to Learn

Designed from the ground up to be learnable. The spec fits in a single document. No hidden magic.

Clean, expressive,
no surprises

Structs, enums, and pattern matching work exactly the way you expect. The syntax is designed to be readable at a glance.

The Result type makes error handling explicit without being verbose. No hidden exceptions — just clean control flow.

Full Language Reference →
structs.rey
600;">struct Point {
    600;">pub x: int,
    600;">pub y: int,
}

600;">enum Color { Red, Green, Blue }

600;">match color {
    Color.Red   => println("red"),
    Color.Green => println("green"),
    _           => println("other"),
}
errors.rey
600;">var result = readFile("data.txt");
600;">if result.isOk() {
    println(result.unwrap());
} 600;">else {
    println("Error: " + result.unwrapOr("unknown"));
}

Try Rey in your browser

No install, no compiler setup. Run Rey code directly in the browser and see the output instantly.

Explore examples for closures, structs, enums, pattern matching, and more — all from the playground.

Open Playground →
fibonacci.rey
600;">func fib(n) {
    600;">if n <= 1 { 600;">return n; }
    600;">return fib(n - 1) + fib(n - 2);
}

600;">var i = 0;
while i < 8 {
    println("fib(" + i + ") = " + fib(i));
    i++;
}

How it works

From source to native binary in one pass. No runtime, no VM.

Source
main.rey
Lexer
Tokens
Parser
AST
LLVM IR
Bitcode
Native
Binary
📝

Hand-written Lexer

The tokenizer is written from scratch — no regex, no generated code. Direct character-by-character scanning for maximum control and performance.

🌳

Recursive Descent Parser

A clean recursive descent parser produces a typed AST. Error messages are precise and point to the exact location of the problem.

🔧

LLVM Backend

Code generation targets LLVM IR, which means Rey benefits from decades of optimization work. Release builds are fast and compact.

Help build something great

Rey is open source and early-stage. There are plenty of high-impact areas to contribute to — from the compiler to documentation.

Start ContributingStar on GitHub