import type { Combinator } from '../types.ts'; /** * Dead-value analysis (shared by the interpreter and codegen). A container * combinator — `many` / `oneOrMore` / `optional` / `sequence` — builds an * aggregate value (array / tuple / nullable). Under a `node()`, the node builds * from the *captured children*, never from that aggregate, so the aggregate is * built and thrown away. This pass marks those containers `valueUnused`; the * interpreter and the emitter then skip building the aggregate entirely (the * elements still parse and self-capture, so trees are identical). * * Walks ONE combinator tree (a single rule body, or a standalone root), stopping * at `lazy`/ref boundaries — other rules are analyzed on their own root. Starts * `consumed = true` (a rule's own value is assumed read — conservative); `node()` * flips it to false for its inner parser; `transform` forces it true (its map fn * reads the value). Sharing-safe: any `consumed = true` visit wins and is sticky, * so a container reachable from BOTH a consuming and a non-consuming site keeps * its aggregate (never wrongly elided). * * Soundness: a container is marked ONLY when every path to it passes through a * `node()` (value-discarding) without an intervening value-reader — i.e. its * aggregate provably isn't observed. Idempotent; safe to re-run. */ export declare function markUnusedValues(root: Combinator): void; //# sourceMappingURL=value-usage.d.ts.map