A Language for Staged Programming

Use ordinary functions to compute values, construct types, and generate checked code at compile time. Build WebAssembly Components with explicit interfaces.

Try Rig in the playground

Early preview. Use Chrome to build and run examples.

(define sum:(Fn Int Int Int) sum=(fn left:Int right:Int do=(add left right))) (provide sum:(Fn Int Int Int))

Programming Across Stages

A runtime integer has type Int. An integer used during compilation has type Int_1. Types make the boundary visible; ordinary Rig functions do the work on either side.

In the staging example, make_id receives a type and constructs a function. Checking turns that bound syntax into code for an ordinary runtime Boolean function. There is no separate macro language.

These examples export library functions. Open them in the playground to edit and build their Components. Getting Started introduces a runnable command with output.

Get started