/** KERN-stdlib lowering table — slices 2a + 2b. * * Per the brainstorm-locked design, KERN handler bodies use module-prefixed * function calls (`Text.upper(s)`) instead of method dispatch (`s.upper()`). * This table maps each KERN-stdlib operation to its per-target template so * the SAME KERN source emits idiomatic TS and idiomatic Python. * * Template shape: each entry's `ts` and `py` fields are template strings * with `$0`, `$1`, … placeholders that reference call args by zero-based * position. The template is a string (not a structured shape) because the * cross-target divergence is irregular enough that any structured shape * ends up being "string with knobs". Concrete divergence cases: * - `Text.includes(s, sub)` → TS `s.includes(sub)` vs Python `sub in s` * (operator, not method) * - `List.isEmpty(xs)` → TS `xs.length === 0` vs Python `len(xs) == 0` * (compound binop expressions, not method/prop) * - `List.join(xs, sep)` → TS `xs.join(sep)` vs Python `sep.join(xs)` * (receiver inverted) * - `List.last(xs)` → TS `xs[xs.length - 1]` vs Python `xs[-1]` * (different subscript expressions) * - `Number.floor(n)` → TS `Math.floor(n)` vs Python `math.floor(n)` * (different module qualification) * Templates handle all of these uniformly. * * Slices in this table: * - 2a: Text upper/lower/length/trim * - 2b: Text+ (includes, startsWith, endsWith, split, replace); * List (length, isEmpty, includes, first, last, indexOf, join); * Map (has, get, size); Number (round, floor, ceil, abs, isFinite, isNaN). * Future slices may extend further (List.map / List.filter need closures, * so they're deferred until closure support — currently never). * * Diagnostic: when codegen sees `.(...)`, it * throws with a Levenshtein did-you-mean. Calls into modules NOT in this * table fall through to the default emit path (passthrough). */ export interface StdlibCallEntry { kind?: 'call'; arity?: number; minArity?: number; maxArity?: number; variadic?: boolean; ts: string | ((args: string[]) => string); py: string | ((args: string[]) => string); /** Slice 3b — per-target imports required when this lowering is used. * The body emitter collects these into a per-handler import set so the * generator can emit `import math` (etc.) at the top of the function * body. Keys are target names ('ts' / 'py'); values are the import * identifier (`'math'` ⇒ `import math`). Undefined when none required. */ requires?: { ts?: string; py?: string; }; } export interface StdlibPropertyEntry { kind: 'property'; ts: string; py: string; requires?: { ts?: string; py?: string; }; } export type StdlibEntry = StdlibCallEntry | StdlibPropertyEntry; export declare const KERN_STDLIB: Record>; export declare const KERN_STDLIB_MODULES: Set; /** Look up a stdlib lowering by module + method name. * Returns null if the module is unknown OR the method is unknown on a known * module — callers should distinguish via `KERN_STDLIB_MODULES.has(module)` * to surface the right diagnostic. */ export declare function lookupStdlib(module: string, method: string): StdlibEntry | null; export declare function lookupStdlibCall(module: string, method: string): StdlibCallEntry | null; export declare function lookupStdlibProperty(module: string, property: string): StdlibPropertyEntry | null; /** Suggest the closest method name on a known module via simple Levenshtein * membership. Used in error messages. Returns null if no close match exists. */ export declare function suggestStdlibMethod(module: string, method: string): string | null; export declare const suggestStdlibMember: typeof suggestStdlibMethod; /** GAP 1 — single source of truth for \"is `module.member` a portable lowering?\". * A member is portable iff `module` is a registered KERN stdlib module AND * `member` resolves to either a call entry or a property entry in the table. * The TS-emit path (`applyStdlibLoweringTS`/`applyStdlibPropertyLoweringTS`), * the Python-emit path, and the IR-validation pass all consult THIS predicate * so an unknown member (`Number.foo`) is treated identically — rejected — by * validation and by emission, instead of the validator silently passing what * the emitter later throws on. */ export declare function isPortableStdlibMember(module: string, member: string): boolean; /** Substitute `$0`, `$1`, … placeholders in a template with the corresponding * args. Throws on out-of-range index — that's a programming error in the * KERN_STDLIB table, not user input. */ export declare function applyTemplate(template: string, args: string[]): string;