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 playgroundEarly preview. Use Chrome to build and run examples.
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.
- Types as Values Construct structural types with ordinary staged functions.
- Checked Code Generate expressions with lexical bindings and check them before insertion.
- Explicit Storage Choose inline copy values or shared reference types, with mutation expressed through their operations.
- Component Interfaces Declare typed imports and exports; the host supplies implementations and authority.