runtime 1.1.4
Checked CEL programs, owned values, and reusable execution stacks
Loading...
Searching...
No Matches
CEL runtime

Note: This project is a temporary solution for using the CEL language from cel-rs in C++. This library will be deprecated when using the Rust implementations from C++ becomes viable.

Build a checked program once, then evaluate it repeatedly on your own reusable stack. This C++20 library supplies program builders, owning results, complete value types, and callable values. To compile CEL text instead of constructing operations in C++, start with CEL parser.

Build from source with CPM

Use CPM to build a static runtime with your application. After adding CPM to your project, declare the dependency and link your application target:

set(CPM_USE_LOCAL_PACKAGES OFF)
include(cmake/CPM.cmake)
CPMAddPackage("gh:stlab/cel-runtime@1.0.0")
add_executable(client main.cpp)
target_link_libraries(client PRIVATE cel::runtime)

Include <cel/runtime.hpp> in your application. The build tutorial includes prerequisites, a complete application, and configure/build commands. No install step is needed.

Build your first program

Push two owned values, add a checked operation, and prepare the result:

builder.just(cel::value::from(2.0));
builder.just(cel::value::from(3.0));
builder.op2<double, double, double>(
[](double left, double right) { return left + right; });
auto program = std::move(builder).finish().prepare<double>();
double result = program.call(stack); // 5.0
A move-only builder of checked, source-ordered operations.
Definition dyn_segment.hpp:249
void just(value literal)
Retains a literal owner and emits an independent clone on every execution.
void op2(F &&callback)
Emits a binary operation that consumes older-first operands and produces R unless it is void.
Definition dyn_segment.hpp:605
An exclusive owner of reusable canonical operand storage.
Definition raw_stack.hpp:47
static value from(const T &source)
Copies a concrete leaf, nominal record adapter, or nested owning vector/tuple value.
Definition value.hpp:229

The template arguments list the result first, followed by the operands in source order. Preparing checks the C++ boundary types once. You can call the prepared program again using the same stack.

Follow the tutorials

Read these guides in order:

  1. Build and link the runtime with CPM.
  2. Compile and reuse a program.
  3. Add types and operations.
  4. Choose execution and ownership boundaries.

The generated documentation places grouped APIs under Reference and symbol lookup under Index. Build it with cmake --preset docs followed by cmake --build --preset docs, then open build/docs/html/index.html.