ocas-eval 0.13.2

Evaluation and JIT code generation for oCAS
Documentation

Evaluation and JIT code generation for oCAS.

This crate provides a stack-based virtual machine for numeric evaluation of symbolic expressions, an AST-to-instruction compiler, a Cranelift JIT backend, and SIMD vectorized evaluation.

Architecture

The evaluation pipeline:

Atom (arena-backed)
  → EvalTree (owned intermediate)
  → Instr sequence (compile + optimize)
  → ExpressionEvaluator (stack VM)
  → or JitCompiledFunction (Cranelift, feature = "jit")
  → or VectorEvaluator (SIMD batch)

Example

use ocas_eval::{ExpressionEvaluator, EvaluationDomain};
use ocas_atom::AtomArena;
use ocas_core::arena::Arena;

let arena = Arena::new();
let ctx = AtomArena::new(&arena);
let expr = ctx.add(&[ctx.var("x"), ctx.num(1)]);

let eval: ExpressionEvaluator<f64> =
    ExpressionEvaluator::compile(&expr).unwrap();
let result = eval.evaluate(&[2.0]).unwrap();
assert_eq!(result[0], 3.0);