Skip to main content

compile

Function compile 

Source
pub fn compile(
    ast: &Expression,
    constants: &HashMap<&str, NumericResult>,
) -> Result<CompiledExpr, CompileError>
Expand description

Compile a mathlex AST into a CompiledExpr ready for evaluation.

Takes a reference to the AST and a map of constant names to values. Constants are substituted at compile time; remaining free variables become arguments that must be provided at eval time.

ยงErrors

Returns CompileError if the AST contains unsupported expression variants, unknown functions, arity mismatches, unresolvable bounds, or division by zero during constant folding.