MCPcopy Create free account
hub / github.com/contextfreeinfo/rio

github.com/contextfreeinfo/rio @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
236 symbols 733 edges 12 files ⚖ CC 5 documented · 2% ● updated 5d agonightly · 2026-11-21★ 103

Browse by type

⨍ Functions 192◇ Types & classes 44
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Rio

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
  • Fast and small. A register VM with typed instructions, about 2–4× faster than Lua. The VM alone is about 11 KB of ARM code; with the compiler, 68 KB.
  • Predictable. No garbage collector, no allocation, and no recursion, so every proc has one fixed frame and a program's memory is known before it runs. Indexes are checked and integers wrap, so errors stop with a line number, never with undefined behavior.
  • Made for hosts. The host provides drawing, sound or files as host procs, declared in Rio with host proc and checked by the compiler. Compiled programs can be saved as images, or turned into C.
  • Friendly to read. Types are inferred, blocks end with end, and structs, builders and text are plain values with no pointers to manage.

Rio, and the 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

Try it

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.

Learn more

  • Tutorial: Rio by example, a page at a time.
  • Spec: what Rio programs mean, mostly as examples, which the tests run.
  • Guide: the C library and CLI: embedding, memory, images, C output, ARM, and performance.
  • Roadmap: what's still being considered on the way to a Rio 1.0 that stays put, and what's been turned down.

The docs build into a web site with mdbook build docs.

Size and speed

Rio's size on the board, lines of C, compile time, and bench times, over time

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.

License

CC0 1.0: dedicated to the public domain (see LICENSE). Use it for anything, with no need to credit; it comes with no warranty.

Extension points exported contracts — how you extend this code

browse all types & interfaces →

Core symbols most depended-on inside this repo

browse all functions →

Shape

Method 135
Function 57
Class 33
Enum 9
Interface 2

Languages

Rust100%

Modules by API surface

src/wasm.rs56 symbols
src/tree.rs34 symbols
src/run.rs29 symbols
src/typ.rs26 symbols
src/parse.rs25 symbols
src/lex.rs16 symbols
src/norm.rs12 symbols
src/main.rs12 symbols
src/core.rs10 symbols
src/util.rs7 symbols
examples/bin-test.rs7 symbols
src/link.rs2 symbols

For agents

$ claude mcp add rio \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page