The Ξ Programming Language
Skip to main content
On this page
The Ξ (Xi) Programming Language
A statically-typed, ahead-of-time compiled language that makes<br>dependency injection , function intent , and<br>refined types first-class — compiled to native binaries<br>through C, and self-hosting.
Get started →<br>GitHub
Xi is self-hosting — its compiler is written in Xi and compiles its own source<br>to a byte-identical fixpoint. The only non-Xi code is a small C runtime (the<br>equivalent of a language's libc/libcore). You don't need any of that to write<br>Xi — install the toolchain and go.
Install
On macOS (Apple Silicon + Intel) and Linux, install with Homebrew :
brew install code-by-sia/xi/xi
Or grab a prebuilt tarball from the<br>releases page and put its bin/ on<br>your PATH. Either way you get xc (compiler) and xi (run tool + REPL); you<br>just need a C compiler (cc) on PATH. Full steps:<br>Getting started.
Highlights
Refined types — type Age = Number where value >= 0 and value ,<br>checked at construction.
Eight function kinds — mapper, projector, predicate, consumer,<br>producer, reducer, creator, action: intent is syntactic.
Dependency injection in the language — deps { ... }, module { bind ... },<br>App.resolve(Interface), conditional when bindings, singleton/transient.
where-guarded overloading — multiple functions with one name, selected by<br>a guard.
Decision tables, interrupts, atoms, machines & events — business rules,<br>resumable conditions, active-state stores, finite state machines, and<br>publish/subscribe with the listener kind, all as language features.
Error handling — T! result types, ok/err, and ? propagation.
Serialization — a built-in std/json library.
Native output — compiles to a standalone binary via C; no VM, no GC.
A taste
import "std/log.xi"
type Age = Number where value >= 0 and value 130
type User = { name: String, age: Age }
predicate isAdult(u: User) { return u.age >= 18 }
mapper describe(u: User) -> String {
return u.name + " (" + u.age + ")"
async entry (logger: Logger) main(args: String[]) {
let u = User { name: "Ada", age: 36 }
if isAdult(u) { logger.info(describe(u)) }
module App {}
$ xc greeting.xi && ./build/greeting
Showcase
See Xi in a real application: eXstream<br>is a music-streaming service whose backend is a set of Xi microservices (auth,<br>file storage, playlist) behind an API gateway, with a React front end and Docker<br>deployment — an end-to-end example of modules, dependency injection, the web<br>framework, and JWT auth.
Ready? Head to Getting started.
Install<br>Highlights<br>A taste<br>Showcase