• Evaluate a parsed formula AST against a FormulaHost.

    Parameters

    Returns FormulaResult

    The FormulaResult produced by the evaluator.

    This is the public entry point that any future Rust evaluator must also satisfy. The TS implementation is a recursive interpreter over the Ast discriminated union; structured failures short- circuit through an internal exception channel and are normalised to an error FormulaResult at this boundary. Unexpected exceptions thrown from the host are surfaced as argument-error.

    const host: FormulaHost = {
    readNumber: (id) => values.get(id) ?? { kind: 'unresolved-ref', message: `${id} missing`, ref: id },
    }
    const result = evaluate(parseFormula('=A1+B1'), host)