Skip to content
CryoCryo home

The Cryo programming language.

Cryo is statically typed and compiles to native machine code through LLVM 20. It has generics, algebraic enums, pattern matching, traits, and trait objects, with manual allocation, raw pointers, and no garbage collector underneath them.

The compiler and the standard library are written in Cryo, and one binary builds, tests, and ships your project.

curl -fsSL https://cryolang.org/install.sh | bash

Install guideLanguage referencePlayground

LLVM 20 / Linux, Windows / Apache-2.0

src/shape.cryo
import std::fmt;

type enum Shape {
    Circle(f64);
    Rectangle(f64, f64);
    Point;
}

function describe(s: Shape) -> void {
    match (s) {
        Shape::Circle(r)       => { fmt::printf("Circle r=%f\n", r); }
        Shape::Rectangle(w, h) => { fmt::printf("Rect %f x %f\n", w, h); }
        Shape::Point           => { fmt::printf("A point\n"); }
    }
}

Toolchain

A project is a directory with a cryoconfig file. Scaffold it, build it, test it, and resolve its git dependencies with the same binary that compiles it. There is no build system to assemble.

cryo init
Scaffold a project - cryoconfig plus src/main.cryo.
cryo build
Compile the project. Incremental by default.
cryo run
Build, then execute the resulting binary.
cryo test
Discover and run every ![test] function, fork-per-test.
cryo check
Front-end and semantic analysis only; no codegen.
cryo fetch
Resolve dependencies and write cryoconfig.lock.

Every command and build flag

shell
cryo init hellocd hellocryo run   Compiling hello v0.1.0    Finished release [optimized] target(s)     Running `build/hello`Hello, world!

In 1.0.0

Self-hosted compiler
Every line of Cryo you compile is compiled by a compiler written in Cryo. A 3-round, 6-stage build asserts the emitted IR is byte-identical between rounds, and it gates every push.
Monomorphised generics
Type parameters with where-bounds, specialised per instantiation. Abstractions compile down to the code you would have written by hand.
Deterministic destruction
Drop glue is synthesised recursively through struct fields, enum payloads, and container elements. Nothing is deferred to a collector, so release order is the reverse of declaration order, every time.
Async with no pinning
An async function compiles to a state machine that is an ordinary value type. Futures are never self-referential, so they move freely and cancellation is just a drop.
Standard library
Collections, iterators, JSON, YAML and TOML, filesystem, threads, channels, atomics, TLS, HTTP/1.1 and HTTP/2 clients and servers, and WebSocket - written in the language, shipping with the compiler.
C FFI
Declare C functions by hand, or import a whole header under an alias and let the compiler synthesise the bindings. static_assert verifies your layouts against the C ABI.

Standard library

Written in the language and shipped with the compiler. Browse the module reference.