/** * Binder — Transform raw AST into BoundExpr. * * The binder performs static symbol resolution: * - Cell/range references → BoundCellRef / BoundAreaRef with resolved sheet * - Defined names → BoundCellRef / BoundAreaRef (if resolvable) or BoundNameExpr * - Structured references → BoundCellRef / BoundAreaRef * - Function calls → BoundCall or BoundSpecialCall * - 3D references → BoundRef3D * * The binder operates on snapshot data only — no live workbook objects. */ import type { WorkbookSnapshot } from "../integration/workbook-snapshot.js"; import type { AstNode } from "../syntax/ast.js"; import type { BoundExpr } from "./bound-ast.js"; /** * Static context for the binder. Contains all information needed to * resolve symbols at compile time. */ export interface BindingContext { /** The workbook snapshot. */ readonly snapshot: WorkbookSnapshot; /** The current sheet name (for relative references). */ readonly currentSheet: string; /** * Identifier names that are bound locally (uppercase). Populated by * LAMBDA when descending into its body; prevents local parameter names * from being shadowed by same-named workbook-level defined names at * compile time. LET uses a different mechanism (it keeps the body * bound as-is and resolves names at runtime via `localBindings`), but * LAMBDA's body is pre-bound when the lambda is constructed so we have * to inject scope info up front. */ readonly localNames?: ReadonlySet; } /** * Bind a raw AST node to produce a BoundExpr. * * This is the main entry point for the compilation phase. It recursively * walks the AST and resolves all symbols against the snapshot. */ export declare function bind(node: AstNode, ctx: BindingContext): BoundExpr;