Browse by type
Disclaimer: Claude Code produced almost every line of code so far.
Rio is a small, statically typed scripting language for embedding, from desktop apps down to microcontrollers. It's one C99 library, a compiler and a VM, that runs in a single block of memory you hand it, and never allocates any more.
Ball :: struct
x, y, vy: Float
end
balls: [..64]Ball
drop :: proc(x: Float)
_ = balls.push({x, y = 0})
end
update* :: proc(dt: Float)
for b in balls # b is the element itself
b.vy += 10 * dt
b.y += b.vy * dt
end
end
drop(1)
drop(2)
for _ in 0..<4
update(0.5)
end
log("fell", balls[0].y, "with", balls.len(), "balls")
fell 25.0 with 2 balls
host proc and checked by the compiler. Compiled programs can be saved as images, or turned into C.end, and structs, builders and text
are plain values with no pointers to manage.rio program: Rio+Rio itself stays small: the language, its builtins, and the C library, riocore, with nothing of an operating system in it. A host adds what it has as modules of its own (a game console's drawing and sound, say).
The rio program is Rio+: Rio, plus a module for scripting on a computer, os:
files and folders, running other programs, the environment and arguments, text in and out (lines read
with editing and history, as in its REPL), and time. A program imports it to use it, so Rio programs
that don't stay plain Rio:
import os
n := os.argCount()
log("arguments:", n)
arguments: 0
cmake -S . -B build && cmake --build build --config Release
build/rio game.rio a b # run a file, a and b its arguments (build/Release/rio.exe with MSVC)
build/rio # or a REPL
Or get a build from the nightly release:
just the one program, zipped on Windows and a .tar.gz on macOS (Apple silicon) and Linux (x86-64, and arm64 for a
Raspberry Pi 4 or 5 with 64-bit Raspberry Pi OS). rio -help lists what it does, and rio -license gives its license.
The docs build into a web site with mdbook build docs.
Each batch of changes adds a row to bench/stats.csv with tools/stats.py --record,
which redraws this chart: the VM and compiler built for the Fruit Jam's Cortex-M33, the C source, and
the benches in the VM and as C, one point per row. Times are from one machine. Rows noted "backfilled"
were measured later, each from its own commit (--backfill); before October 16, when the C was all one
file, there's no split of the VM from the compiler to show.
CC0 1.0: dedicated to the public domain (see LICENSE). Use it for anything, with no need to credit; it comes with no warranty.
browse all types & interfaces →