Modern abstractions. Machine-level control.
Cryo is statically typed and compiles to native machine code through LLVM 20. The compiler is self-hosted, the standard library is written in Cryo, and one binary builds, tests, and ships your project.
curl -fsSL https://cryolang.org/install.sh | bash- Backend
- LLVM 20
- Targets
- Linux · Windows
- License
- Apache-2.0
Familiar surface, explicit underneath
Generics, algebraic enums, pattern matching, traits, and single-inheritance classes - with manual allocation, raw pointers, and no garbage collector underneath them.
Full language referenceimport std::fmt;
function main() -> int {
fmt::printf("Hello, world!\n");
return 0;
}import a::b;
import a::b::{ X, Y };
import a::b as c;
import a::b::*;Brings a module, or selected items from it, into scope. One path per declaration: use the brace form for several items, as to alias, and * for everything public (prefer the brace form; wildcards invite name collisions).
function name<T>(param: Type) -> Ret { ... }Declares a function. Parameters are written name: Type and are never inferred; the return type follows -> and defaults to void. Declaration order does not matter: every signature is collected before any body is checked, so functions may call each other freely and recurse.
function main() -> intfunction printf(fmt: string, args...) -> i32Write a printf-style formatted string to stdout. Returns the number of bytes written, or a negative value on error (libc printf convention). Use this for genuinely variadic %s/%d output; for value formatting prefer an f-string through println (Display-based) below.
return value;Leaves the current function with the given value. A function whose return type is not void must return one; a bare return; is for void. In an async function it completes the future with the value.
A namespace, a main, and a return code. printf is an intrinsic auto-imported into every module.
One binary
No build system to assemble
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.
- 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.
cryo init hellocd hellocryo run Compiling hello v0.1.0 Finished release [optimized] target(s) Running `build/hello`Hello, world!What ships 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, JSON, filesystem, threads, atomics, TLS, HTTP/1.1 and HTTP/2, and WebSocket - written in the language, shipping with the compiler.
Real 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
A language with batteries included
- core
Option, Result, Slice, traits, memory utilities
- alloc
Box, Rc, Arc, Arena, Pool, Allocator
- collections
Array, String, Str, HashMap, HashSet
- io
Read/Write traits, buffered wrappers, stdio
- fmt
Display, Debug, Formatter, the print family
- json
RFC 8259 parser and serialiser
- fs
Path, File, OpenOptions, directory walking
- net
TCP, UDP, TLS, HTTP/1.1, HTTP/2, WebSocket
- sync
Atomic<T>, Mutex, RwLock, CondVar, channels
- thread
spawn, JoinHandle, scoped threads, TLS
- time
Duration, Instant, SystemTime, sleep
- test
The built-in unit-test framework
Install it in one line
The quick-install binary is statically linked - it needs nothing on your machine but a C compiler to link the programs you build.
curl -fsSL https://cryolang.org/install.sh | bash