exp-rs 0.2.0

no_std expression parser, compiler, and evaluation engine for math expressions designed for embedded, with qemu examples
Documentation
extern crate alloc;
use crate::Real;
use crate::context::EvalContext;
use crate::error::ExprError;
use crate::types::AstExpr;
#[cfg(not(test))]
use alloc::rc::Rc;
#[cfg(test)]
use std::rc::Rc;

pub fn eval_ast<'arena>(
    ast: &'arena AstExpr<'arena>,
    ctx: Option<Rc<EvalContext>>,
    arena: &'arena bumpalo::Bump,
) -> Result<Real, ExprError> {
    // Use the iterative evaluator - this eliminates stack overflow issues
    // and provides better performance than the recursive approach
    crate::eval::iterative::eval_iterative(ast, ctx, arena)
}