/** * Serialize a compiled rule map BACK to a compact combinator-construction source * expression — the "IR" a composed grammar carries instead of ~1MB of fully * lowered `_r_` function source. At fuse time the expression is evaluated * (with the combinator constructors in scope) to reconstruct the rule map, then * re-lowered via `compileLinkable` — identical behaviour, a fraction of the bytes. * * The output mirrors how a grammar is WRITTEN, not how it lowers: * - a rule reference (`g.Foo`, a `lazy` carrying `_ruleName`) → `g["Foo"]` * - a sub-combinator shared by identity (referenced ≥2×, e.g. a `balanced` const * reused across rules) → a hoisted `const _s = …`, referenced by name, so it * stays shared through the round trip (and `compileLinkable` re-hoists it) * - a self-referential combinator (`balanced`'s internal `self = ref()`) → a * `ref()` + `.define()` closure, the same shape the library combinator emits * - `transform`/`node` callbacks → their captured source (`fnSrc`/`buildSrc`) * * Returns null if the map can't be faithfully serialized (a callback without * source, or an unsupported construct) — the caller then keeps the lowered source. */ import type { Combinator } from '../types.ts'; type Comb = Combinator; export declare function serializeRuleMap(ruleMap: ReadonlyArray, scanSkip?: readonly Comb[] | null): string | null; /** Reconstruct a rule map from serialized IR (the inverse of `serializeRuleMap`) — * evaluate the combinator-construction expression with every constructor in scope. * Used at fuse time (runtime linker + build-time plugin) to re-lower carried IR. */ export declare function evalRuleMapIR(ir: string): Array<[string, Comb]>; export {}; //# sourceMappingURL=ir-serialize.d.ts.map