About Rey

Rey is an experimental programming language built to explore language design, compiler construction, and execution models. It's designed to be simple, fast, and — as of v0.2.0 — self-hosting.

What is Rey?

Rey is a compiled, statically-typed programming language. It targets native machine code via LLVM, giving programs the performance characteristics of languages like C or Rust, but with a cleaner and more approachable syntax.

Unlike most compiled languages that require complex build systems and boilerplate, Rey is designed to be simple. The spec fits in a single document. The standard library is minimal but complete. The compiler gives clear, precise error messages.

Rey's most notable feature is that its compiler is written in Rey itself — a property called self-hosting. This was achieved in v0.2.0 and represents a major milestone in the language's maturity.

Philosophy

Simplicity over features

Rey does not chase feature completeness. Every new feature has to justify itself. A smaller language is easier to learn and easier to implement correctly.

📋

Spec-first design

The language is defined by a specification document, not by implementation behavior. The spec is the source of truth.

🔒

Compile-time correctness

Errors should be caught at compile time, not runtime. The type system exists to make programs more correct, not to add friction.

👁

No hidden magic

Rey has no implicit conversions, no hidden allocations, and no surprising runtime behaviors. What you write is what you get.

History

Early 2024

Project begins

Rey started as a personal project to understand how compilers work from the inside. The initial interpreter was written in Rust.

Mid 2024

v0.1.0 — Tree-walk interpreter

First public release with a working tree-walk interpreter. Variables, functions, structs, enums, and a basic standard library.

Late 2024

LLVM backend work begins

Work starts on a native code generation backend via LLVM IR. The goal: eliminate the interpreter and produce real machine code.

Early 2025

Bootstrap compiler ships

A Rust-based compiler targeting LLVM IR is complete. Rey programs now compile to native binaries on macOS arm64.

April 2025

v0.2.0 — Self-hosting achievedCurrent

The compiler is rewritten in Rey itself. v0.2.0 compiles itself — a landmark milestone in the language's development.

Technical Details

Compiler architecture

The Rey compiler is a single-pass recursive descent compiler. Source code flows through a hand-written lexer, a recursive descent parser that produces a typed AST, a type-checker and resolver, and finally an LLVM IR code generator. No parser generators or external tools are used.

LLVM backend

Rey targets LLVM IR, which means it benefits from the full LLVM optimization pipeline. Release builds pass through aggressive optimization levels. The generated IR is then compiled to native machine code by LLVM's JIT or the static linker.

C runtime

Rey programs link against a thin C runtime that provides the OS interface — memory allocation, file I/O, and process management. This runtime is small (~200 lines of C) and is statically linked into the binary.

Self-hosting

As of v0.2.0, the Rey compiler is written in Rey. This was bootstrapped by compiling the initial compiler with the Rust bootstrap compiler, then using the resulting binary to compile the Rey-based compiler. The bootstrap compiler is still available for toolchain development.

What's next

Linux and Windows support, a proper package manager, improved error messages, and more standard library coverage. All of it in the open, with contributors welcome.