Skip to content

Repository files navigation

cel-rs

CI Docs

A stack-based runtime for developing domain specific languages, paired with a recursive-descent parser for CEL (Common Expression Language) and a proc-macro crate for compile-time CEL validation. See docs/VISION.md for the long-term direction behind each crate in this workspace.

Status: this project has not been released and has no clients yet. It is in active development and the API may change at any time.

Workspace layout

Crate Role
cel-rs Root façade crate — re-exports the crates below
cel-runtime Core stack-based runtime; all evaluation and stack machinery
cel-parser Recursive-descent CEL parser, lexer, and error types
cel-rs-macros Proc-macro crate for compile-time CEL expression validation
adam-rs Multi-way constraint system for property models
adam-lang DSL that expresses adam-rs constraint systems as source text
adam-lsp Language server for adam-lang
begin Dioxus-based UI application for developing property models
editors/vscode-adam-lang VS Code extension: syntax highlighting and live diagnostics for adam-lang, via adam-lsp
xtask Repository automation and maintenance tasks

Getting started

Prerequisites

  • Rust (stable), installed via rustup

Clone and build

git clone https://github.com/stlab/cel-rs.git
cd cel-rs
git config core.hooksPath .githooks   # activate the shared git hooks (one-time)
cargo build --workspace
cargo test --workspace

Add cel-rs to your project

cargo add cel-rs

A first expression

use cel_rs::runtime::Segment;

// Build a segment that takes a u32 and a &str as arguments.
let segment = Segment::<(u32, &str)>::new()
    .op1r(|s| {
        let r = s.parse::<u32>()?;
        Ok(r)
    })
    .op2(|a, b| a + b)
    .op1(|r| r.to_string());
assert_eq!(segment.call((1u32, "2")).unwrap(), "3");

This builds a small pipeline over cel-runtime's typed stack: parse the &str into a u32 (fallibly, via op1r), add it to the u32 argument, then format the result. cel-parser and cel-rs-macros cover the other two ways to produce a segment: parsing CEL source at runtime, and validating/compiling CEL expressions at compile time. See src/lib.rs for one example of each.

Full API documentation for every crate in the workspace is published from main at https://stlab.github.io/cel-rs/.

Development

See CLAUDE.md for the full command reference (build, test, lint, sanitizers) and repository conventions, including the requirement to work in a separate git worktree for any change.

begin: Spectrum Web Components bundle

begin/assets/swc.js is a single bundle (elements + Spectrum 2 theme tokens + the zoom-control icons) produced by esbuild from real npm packages. It's committed like every other vendored asset, so cloning and building begin needs no Node/npm setup.

Node.js + npm are only needed if you're updating the Spectrum version or otherwise need to regenerate begin/assets/swc.js:

cargo xtask build-js

or directly:

cd begin
npm ci
npm run build

Commit the regenerated begin/assets/swc.js along with any begin/package.json/ begin/package-lock.json changes. See docs/superpowers/specs/2026-07-11-begin-spectrum2-theme-tokens-design.md for why this needs to be one compiled bundle rather than separate vendored/live files.

adam-lang: VS Code extension

editors/vscode-adam-lang is a VS Code extension providing syntax highlighting and live diagnostics for .adm2 (adam-lang) files, backed by the adam-lsp language server.

To install it locally:

cargo install --path adam-lsp
cd editors/vscode-adam-lang
npm install
npm run package
npm run install-extension

Both the cargo install and the two npm steps are also available as a single VS Code task, Install adam-lsp + Extension (Local), runnable from the Command Palette's "Tasks: Run Task" with either the repository root or editors/vscode-adam-lang open. See editors/vscode-adam-lang/README.md for the full Extension Development Host walkthrough and troubleshooting notes.

About

WIP of library for type-safe concatenative languace

Resources

Stars

6 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages