@mark1russell7/vex-compiler 0.18.0 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["NEGATIVE_ZERO","vars"],"sources":["../src/loop.ts","../src/js.ts","../src/lower.ts","../src/runtime.ts","../src/tiers.ts"],"sourcesContent":["import type { Addr, Axis, ErrorText, FixJoin, PrimitiveKind } from \"@mark1russell7/vex\";\n\n/**\n * The loop IR (docs/COMPILER.md §3.3): a small language of statements between the Vex IR and the back ends. It has\n * locals, loops over arrays, checks and the functions of the runtime. A back end reads only this IR.\n *\n * A check that fails stops the program with a lazy error, and a materialize step gives the error of the interpreter\n * (§4.1). Where the error has a use, a check that cannot name its error stops the program with the value `FALLBACK`, and\n * tier 1 evaluates it. A check with the failure `STOP` stops the program in each context, because its failure is no error.\n */\n\n/** The fixed locals of each program: the space, the origin, the variables and the tables of the run. */\nexport const SPACE = 0;\nexport const ORIGIN = 1;\nexport const VARS = 2;\nexport const TABLES = 3;\n/** The number of fixed locals. */\nexport const FIXED_LOCALS = 4;\n\n/** The functions of the runtime that generated code calls. Each one gives `FALLBACK` for a value it cannot give. */\nexport type RuntimeFn =\n | \"has\" // has(space, key): boolean\n | \"addr\" // addr(space, origin, focus, address, values?): the key of an address, with the values of its computed moves\n | \"table\" // table(tables, name): the space of a table\n | \"keys\" // keys(space): the keys of a space\n | \"rowIndex\" // rowIndex(space, key): the index of a key in the keys of a space, or undefined\n | \"rounds\" // rounds(space): the largest number of rounds of a column of the space (FIX.LIMIT)\n | \"step\" // step(name, acc, value): one step of reduce\n | \"result\" // result(value): the checks of the value of an op\n | \"opts\" // opts(value): the read of the option strict of a list op\n | \"rec\" // rec(names, values): a frozen record\n | \"list\" // list(keys, values): a list of an axis\n | \"items\" // items(value, reverse): the targets of the axis list, or FALLBACK for a value that is not a list\n | \"frozen\" // frozen(array): a frozen copy\n | \"ext\" // ext(kind, data, space, origin, focus, path): an extension\n | \"var\" // var(vars, name): a variable of the run\n | \"err\" // err(site, origin, focus, ...operands): the lazy error of a failed check\n | \"raise\" // raise(error): the end of the program with a lazy error\n | \"args\" // args(site, origin, focus, errors): the error of the arguments that failed, or undefined for no error\n | \"bad\" // bad(value): the record of a result of an op that failed its checks\n | \"invalid\"; // invalid(thrown, domain): the record of an exception of a check `valid`\n\n/** The primitive operations of the loop IR. They copy no arithmetic of a domain (§4.2). */\nexport type PrimOp =\n | \"+\" // the sum of a reduction, in the order of the interpreter\n | \"/\" // the mean of a reduction\n | \"===\"\n | \"!==\"\n | \"!\"\n | \"||\"\n | \"&&\"\n | \"min\" // Math.min, the minimum of a reduction\n | \"max\" // Math.max, the maximum of a reduction\n | \"isNumber\"\n | \"isFinite\" // Number.isFinite: a number that is not NaN and not an infinity\n | \"isBoolean\"\n | \"isString\"\n | \"isValue\" // not undefined and not null\n | \"isObject\" // an object or a function\n | \"unless\" // unless(ok, error): the error, or undefined when ok is true\n | \"get\" // get(space, key): the record of a key\n | \"member\" // member(object, name): the property of an object\n | \"records\" // records(space): the records of the space by index, or undefined (SPACE.RECORDS)\n | \"recordAt\" // recordAt(records, index, space, key): the record at an index, or else the record of the key\n | \"keysOf\" // keysOf(targets): the keys of the targets of an axis\n | \"idxOf\" // idxOf(targets): the index of each target in the keys of the space\n | \"valuesOf\" // valuesOf(targets): the value of each target of the axis list\n | \"memoGet\" // memoGet(memo, space, keys): the entry of a space and the values of its keys, or undefined\n | \"memoPut\" // memoPut(memo, space, keys, value, ok): the new entry of a space and the values of its keys\n | \"entryValue\" // entryValue(entry): the value of an entry of a memo\n | \"entryOk\"; // entryOk(entry): true if the entry has a value\n\n/** A value of the loop IR. */\nexport type LExpr =\n | { readonly t: \"const\"; readonly i: number }\n | { readonly t: \"local\"; readonly n: number }\n | { readonly t: \"num\"; readonly v: number }\n | { readonly t: \"bool\"; readonly v: boolean }\n | { readonly t: \"fallback\" }\n /** The value `undefined`: no error. */\n | { readonly t: \"none\" }\n /** The `ErrorSite` at the index `i` of the constants. Only a failure reads it. */\n | { readonly t: \"site\"; readonly i: number }\n | { readonly t: \"array\"; readonly items: readonly LExpr[] }\n | { readonly t: \"prim\"; readonly op: PrimOp; readonly args: readonly LExpr[] }\n | { readonly t: \"call\"; readonly fn: RuntimeFn; readonly args: readonly LExpr[] }\n /**\n * The dispatch of the op whose name is the constant `name`, with the values of its arguments, the receiver first.\n * `kinds` are the kinds of the values that the lowering knows (KIND.STATIC).\n */\n | { readonly t: \"op\"; readonly name: number; readonly args: readonly LExpr[]; readonly kinds: readonly (PrimitiveKind | undefined)[] }\n /** The memo `id` of the program: the value of one node for each space (§7.2). */\n | { readonly t: \"memo\"; readonly id: number }\n /** The targets of the base axis that is the constant `axis`, at the space, the origin and the focus of `args`. */\n | { readonly t: \"targets\"; readonly axis: number; readonly args: readonly [LExpr, LExpr, LExpr] };\n\n/**\n * The site of an error: the facts of the error that the lowering knows (docs/COMPILER.md §4.1). The operands of a\n * failure give the other facts. Each site has the path of its node, and `materialize` of the runtime reads it.\n */\nexport type ErrorSite =\n /** The origin is not a key of the space. */\n | { readonly t: \"key\" }\n /** The text does not depend on a value of the run. */\n | { readonly t: \"text\"; readonly text: ErrorText; readonly path: readonly number[] }\n /** A call of a name that is not a function here. Its operand is the variables of the run. */\n | { readonly t: \"call\"; readonly name: string; readonly path: readonly number[] }\n /** A reference that reads no value. Its operand is the key. */\n | { readonly t: \"missing\"; readonly where: string; readonly path: readonly number[] }\n /** An argument of a special form that is not a boolean. Its operand is the value. */\n | { readonly t: \"boolean\"; readonly op: string; readonly i: number; readonly path: readonly number[] }\n /** An item of a list op of the wrong kind. Its operand is the item. */\n | { readonly t: \"items\"; readonly op: string; readonly what: \"numbers\" | \"booleans\"; readonly path: readonly number[] }\n /** The test `until` of `iterate`, without a boolean. Its operand is the value. */\n | { readonly t: \"until\"; readonly path: readonly number[] }\n /** The limit of `iterate`, with no true value of the test. Its operand is the number of steps. */\n | { readonly t: \"limit\"; readonly path: readonly number[] }\n /** The round limit of a column, with rows that change. Its operand is the number of rounds. */\n | { readonly t: \"fixLimit\"; readonly name: string; readonly path: readonly number[] }\n /** A value of a row of the wrong kind, or a number that is not finite. Its operand is the value. */\n | { readonly t: \"row\"; readonly name: string; readonly join: FixJoin; readonly path: readonly number[] }\n /** A read of a column at a key that is not a row. */\n | { readonly t: \"lastKey\"; readonly name: string; readonly path: readonly number[] }\n /** Two or more rows of a round that failed (FIX.ERROR). Its operands are their errors. */\n | { readonly t: \"rows\"; readonly path: readonly number[] }\n /** The test of `where`, without a boolean. Its operand is the value. */\n | { readonly t: \"test\"; readonly path: readonly number[] }\n /** The axis `list` over a value that is not a list. Its operand is the value. */\n | { readonly t: \"listAxis\"; readonly path: readonly number[] }\n /** A failure of an op. The runtime recorded the detail of the failure. */\n | { readonly t: \"op\"; readonly op: string; readonly path: readonly number[] }\n /** A failure of a step of `reduce`. Its operand is the name of the op. */\n | { readonly t: \"step\"; readonly path: readonly number[] }\n /** A failure of an extension. The runtime recorded the detail of the failure. */\n | { readonly t: \"ext\"; readonly kind: string; readonly path: readonly number[] }\n /** An address that gives no key. Its operands are the space and the values of its computed moves. */\n | { readonly t: \"addr\"; readonly at: Addr; readonly path: readonly number[] }\n /** An axis that gives no targets. Its operands are the space and the focus. */\n | { readonly t: \"axis\"; readonly axis: Exclude<Axis, { readonly t: \"where\" }>; readonly path: readonly number[] }\n /** Two or more arguments or fields that failed. Its operands are their errors. */\n | { readonly t: \"args\"; readonly what: string; readonly path: readonly number[] };\n\n/**\n * What a failed check does. The interpreter gives an error value at the node of the check, and the context of the node\n * decides what happens to that error:\n *\n * - `return`: the program stops with the lazy error of the check.\n * - `stop`: the program stops with `FALLBACK`, and tier 1 evaluates it again. The check has no lazy error.\n * - `continue`: the item of a list op is an error item. The list op skips it, as the interpreter does. With the option\n * `strict`, the list op fails instead, and `strict.else` tells what that failure does.\n * - `break`: the block ends. For the first argument of `ifError`, the second argument then gives the value. With `keep`,\n * the local `keep` gets the lazy error, so a later read of it can stop the program.\n */\nexport type Fail =\n | { readonly t: \"return\" }\n | { readonly t: \"stop\" }\n | { readonly t: \"continue\"; readonly label: number; readonly strict?: { readonly cond: LExpr; readonly else: Fail } }\n | { readonly t: \"break\"; readonly label: number; readonly keep?: number };\n\n/** A statement of the loop IR. */\nexport type LStmt =\n /** A new local with a value. */\n | { readonly t: \"let\"; readonly n: number; readonly value: LExpr }\n /** A new value of a local. */\n | { readonly t: \"set\"; readonly n: number; readonly value: LExpr }\n /** When `ok` is false, the statement does `fail`. The reason names the check, and `error` is its lazy error. */\n | { readonly t: \"check\"; readonly ok: LExpr; readonly reason: string; readonly fail: Fail; readonly error?: LExpr }\n /** A check that fails always: the interpreter always gives an error here. */\n | { readonly t: \"fail\"; readonly fail: Fail; readonly error?: LExpr }\n | { readonly t: \"if\"; readonly cond: LExpr; readonly yes: readonly LStmt[]; readonly no: readonly LStmt[] }\n /**\n * A loop over the items of an array, in order. The local `array` holds the array, `index` the index, and `item` each\n * item. A `continue` with the label goes to the next item.\n */\n | { readonly t: \"loop\"; readonly label: number; readonly item: number; readonly index: number; readonly array: number; readonly over: LExpr; readonly body: readonly LStmt[] }\n /** A block with a label. A `break` with the label ends it. */\n | { readonly t: \"block\"; readonly label: number; readonly body: readonly LStmt[] }\n /** The end of the block with the label. */\n | { readonly t: \"break\"; readonly label: number }\n /** A loop with a label that repeats its body until a `break` with the label ends it. */\n | { readonly t: \"repeat\"; readonly label: number; readonly body: readonly LStmt[] }\n /** The next item of the innermost loop. */\n | { readonly t: \"next\" }\n /** A value at the end of an array. */\n | { readonly t: \"push\"; readonly n: number; readonly value: LExpr }\n | { readonly t: \"return\"; readonly value: LExpr };\n\n/** A program of the loop IR: its statements, the number of its locals and its constants. Each local is a name in the function. */\nexport interface LoopProgram {\n readonly body: readonly LStmt[];\n readonly locals: number;\n /** The constants, by index: literals, paths, addresses, axes and names. Generated code reads them by index (§5). */\n readonly constants: readonly unknown[];\n}\n\n// The constructors of the values of the loop IR.\nexport const local = (n: number): LExpr => ({ t: \"local\", n });\nexport const constant = (i: number): LExpr => ({ t: \"const\", i });\nexport const num = (v: number): LExpr => ({ t: \"num\", v });\nexport const bool = (v: boolean): LExpr => ({ t: \"bool\", v });\nexport const FALLBACK_EXPR: LExpr = { t: \"fallback\" };\nexport const RETURN: Fail = Object.freeze({ t: \"return\" });\nexport const STOP: Fail = Object.freeze({ t: \"stop\" });\nexport const array = (...items: LExpr[]): LExpr => ({ t: \"array\", items });\nexport const prim = (op: PrimOp, ...args: LExpr[]): LExpr => ({ t: \"prim\", op, args });\nexport const call = (fn: RuntimeFn, ...args: LExpr[]): LExpr => ({ t: \"call\", fn, args });\n\n/** This function tells if a failure uses the lazy error of its check. */\nexport function keeps(f: Fail): boolean {\n switch (f.t) {\n case \"return\":\n return true;\n case \"stop\":\n return false;\n case \"break\":\n return f.keep !== undefined;\n case \"continue\":\n return f.strict !== undefined && keeps(f.strict.else);\n }\n}\n\n/** This function gives the failure of a check without a lazy error. Where the error has a use, the program stops. */\nexport function plainOf(f: Fail): Fail {\n if (f.t === \"continue\") return f.strict === undefined ? f : { ...f, strict: { cond: f.strict.cond, else: plainOf(f.strict.else) } };\n return f.t === \"break\" && f.keep === undefined ? f : STOP;\n}\n","/**\n * The back end of JavaScript source (docs/COMPILER.md §3.4). It prints a program of the loop IR as the body of a\n * function with the parameters `K` (the constants) and `R` (the runtime).\n *\n * The source has no name and no literal of the program as text: it reads each one from `K`, by its index (§5). The\n * same program and the same facts always give the same source.\n *\n * With the facts of the options, each op site gets its fast path in the source (§13.2). Each site then has its own\n * inline caches in the engine, and a guard sends each other case to the dispatch of the runtime.\n */\nimport { liftsAt, type ParamKind } from \"@mark1russell7/vex\";\nimport { primitiveOf, type Facts, type SiteFacts, type StaticSite } from \"./facts.ts\";\nimport { call, constant, FIXED_LOCALS, type Fail, type LExpr, type LoopProgram, type LStmt, type RuntimeFn } from \"./loop.ts\";\n\ntype OpExpr = Extract<LExpr, { readonly t: \"op\" }>;\n\n/** This function gives the call of the dispatch of a site. With more than 3 values, the dispatch takes an array. */\nfunction generic(x: OpExpr, site: string, values: readonly string[]): string {\n return x.args.length <= 3 ? `${site}(${values.join(\", \")})` : `${site}([${values.join(\", \")}])`;\n}\n\n/** This function gives the check of an argument of the kind `kind`, for an op of the domain `d`. */\nfunction kindCheck(kind: ParamKind | undefined, a: string, d: string): readonly string[] {\n if (kind === \"domain\") return [`${d}.is(${a})`];\n if (kind === \"number\" || kind === \"boolean\" || kind === \"string\") return [`typeof ${a} === \"${kind}\"`];\n return [];\n}\n\nconst name = (n: number): string => `l${n}`;\n\n/**\n * This function prints the source of a program. The body gives the function of the program. The source of a compile has\n * no indent, so its size stays linear in the block nesting (COMPILE.SOURCE.SIZE). With `indented`, each line shows its\n * block. The golden files read that form, and the two forms differ only in the spaces at the start of a line.\n */\nexport function printJs(p: LoopProgram, facts: Facts, indented = false): string {\n const deeper = (indent: string): string => (indented ? `${indent} ` : indent);\n const used = new Set<RuntimeFn>();\n const constants = new Set<number>();\n const sites = new Map<string, string>();\n const domains = new Set<number>();\n // The functions of the ops of the static sites. They read the domains, so they come after them.\n const fns = new Map<string, string>();\n let threw = false;\n let siteLabels = 0;\n const expr = (x: LExpr): string => {\n switch (x.t) {\n case \"const\":\n constants.add(x.i);\n return `k${x.i}`;\n case \"local\":\n return name(x.n);\n case \"num\":\n case \"bool\":\n return String(x.v);\n case \"fallback\":\n return \"F\";\n case \"none\":\n return \"undefined\";\n case \"site\":\n return `K[${x.i}]`;\n case \"array\":\n return `[${x.items.map(expr).join(\", \")}]`;\n case \"call\":\n used.add(x.fn);\n return `${x.fn}_(${x.args.map(expr).join(\", \")})`;\n case \"op\":\n return generic(x, siteOf(x), x.args.map(expr));\n case \"memo\":\n sites.set(`mo${x.id}`, \"R.memo()\");\n return `mo${x.id}`;\n case \"targets\": {\n // An axis has one function of targets for each site, with its cache.\n const site = `a${x.axis}`;\n sites.set(site, `R.axis(${expr(constant(x.axis))})`);\n return `${site}(${x.args.map(expr).join(\", \")})`;\n }\n case \"prim\": {\n const [a, b, c, d, e] = x.args.map(expr);\n switch (x.op) {\n case \"!\":\n return `(!${a})`;\n case \"min\":\n case \"max\":\n return `Math.${x.op}(${a}, ${b})`;\n case \"isNumber\":\n return `(typeof ${a} === \"number\")`;\n case \"isFinite\":\n return `Number.isFinite(${a})`;\n case \"isBoolean\":\n return `(typeof ${a} === \"boolean\")`;\n case \"isString\":\n return `(typeof ${a} === \"string\")`;\n case \"isValue\":\n return `(${a} !== undefined && ${a} !== null)`;\n case \"isObject\":\n return `(typeof ${a} === \"object\" || typeof ${a} === \"function\")`;\n case \"unless\":\n return `(${a} ? undefined : ${b})`;\n case \"get\":\n return `${a}.get(${b})`;\n case \"member\":\n return `${a}[${b}]`;\n case \"records\":\n return `${a}.records`;\n case \"recordAt\":\n return `(${a} !== undefined ? ${a}[${b}] : ${c}.get(${d}))`;\n case \"keysOf\":\n return `${a}.keys`;\n case \"idxOf\":\n return `${a}.idx`;\n case \"valuesOf\":\n return `${a}.values`;\n case \"memoGet\":\n return `${a}.get(${b}, ${c})`;\n case \"memoPut\":\n return `${a}.put(${b}, ${c}, ${d}, ${e})`;\n case \"entryValue\":\n return `${a}.v`;\n case \"entryOk\":\n return `${a}.ok`;\n case \"+\":\n case \"/\":\n case \"===\":\n case \"!==\":\n case \"||\":\n case \"&&\":\n return `(${a} ${x.op} ${b})`;\n }\n }\n }\n };\n // An op has one dispatch for each name and number of arguments, and the function gets it when it loads.\n function siteOf(x: OpExpr): string {\n const site = `s${x.name}_${x.args.length}`;\n sites.set(site, `R.site(${expr(constant(x.name))}, ${x.args.length})`);\n return site;\n }\n const domain = (i: number): string => {\n domains.add(i);\n return `d${i}`;\n };\n // The record of a result that failed its checks. The result is `FALLBACK` after it.\n const bad = (out: string): string => {\n used.add(\"bad\");\n return `${out} = bad_(${out});`;\n };\n // The check `valid` of the domain at the index `i`, with the record of its failure.\n const validity = (out: string, i: number): string => {\n used.add(\"invalid\");\n return `try { if (!${domain(i)}.valid(${out})) ${bad(out)} } catch (e) { ${out} = invalid_(e, ${i}); }`;\n };\n // The checks of the result of an op, as `#checkResult` of the interpreter. A domain without `valid` stops the search.\n const resultChecks = (out: string, checks: readonly boolean[], indent: string): void => {\n lines.push(`${indent}if (${out} !== F) {`);\n lines.push(`${indent} if (${out} === undefined || ${out} === null || (typeof ${out} === \"number\" && !Number.isFinite(${out}))) ${bad(out)}`);\n checks.forEach((valid, i) => {\n lines.push(valid ? `${indent} else if (${domain(i)}.is(${out})) { ${validity(out, i)} }` : `${indent} else if (${domain(i)}.is(${out})) {}`);\n });\n lines.push(`${indent}}`);\n };\n /**\n * The fast path of an op site that assigns the local `n`. A method site guards the method of the last receiver and\n * the domain of the receiver, and a site of a function guards the domain. Then the site checks the arguments, calls\n * the op in a `try`, and checks the result. A number that the op lifts, and each failed guard, go to the dispatch.\n */\n const siteBlock = (n: number, x: OpExpr, indent: string): boolean => {\n const attempt = (invoked: string, ind: string): void => {\n threw = true;\n lines.push(`${ind}try { ${name(n)} = ${invoked}; } catch (e) { ${name(n)} = threw_(e); }`);\n };\n const st = facts.staticSite(p.constants[x.name] as string, x.kinds);\n if (st !== undefined) {\n staticBlock(n, x, st, indent, attempt);\n return true;\n }\n const f = facts.site(p.constants[x.name] as string, x.args.length);\n switch (f?.t) {\n case undefined:\n return false;\n case \"free\": {\n const site = siteOf(x);\n sites.set(`${site}_f`, `${site}.free`);\n attempt(`${site}_f(${x.args.map(expr).join(\", \")})`, indent);\n resultChecks(name(n), facts.checks, indent);\n return true;\n }\n case \"op\":\n opBlock(n, x, f, indent, attempt);\n return true;\n }\n };\n /**\n * The block of a static site (KIND.STATIC). The kinds of its values decide its op, so the site uses the function of the\n * op with no guard. A result of another kind breaks the declaration of the op. Then the program stops, and tier 1\n * evaluates it. An argument of a kind that the op does not accept goes to the dispatch, which gives the failure.\n */\n const staticBlock = (n: number, x: OpExpr, st: StaticSite, indent: string, attempt: (call: string, ind: string) => void): void => {\n const out = name(n);\n const values = x.args.map(expr);\n if (st.t === \"free\") {\n const site = siteOf(x);\n sites.set(`${site}_f`, `${site}.free`);\n attempt(`${site}_f(${values.join(\", \")})`, indent);\n resultChecks(out, facts.checks, indent);\n return;\n }\n if (st.bad) {\n lines.push(`${indent}${out} = ${generic(x, siteOf(x), values)};`);\n return;\n }\n const f = `f${x.name}_${st.domain}`;\n fns.set(f, `${domain(st.domain)}.ops[${expr(constant(x.name))}].fn`);\n attempt(`${f}(${values.join(\", \")})`, indent);\n // A local of tier 2 has a primitive kind or no kind (lower.ts). Thus a result of the kind of a domain gets the checks\n // of the interpreter, as a result of the kind any (V-059).\n const kind = primitiveOf(st.returns);\n if (kind === undefined) {\n resultChecks(out, facts.checks, indent);\n return;\n }\n lines.push(`${indent}if (${out} !== F && typeof ${out} !== \"${kind}\") return F; // the kind of the result`);\n if (kind === \"number\") lines.push(`${indent}if (${out} !== F && !Number.isFinite(${out})) ${bad(out)}`);\n const check = facts.checkOf(kind);\n if (check === undefined) resultChecks(out, facts.checks, indent);\n else if (facts.checks[check] === true) lines.push(`${indent}if (${out} !== F) { ${validity(out, check)} }`);\n };\n const opBlock = (n: number, x: OpExpr, f: Extract<SiteFacts, { readonly t: \"op\" }>, indent: string, attempt: (call: string, ind: string) => void): void => {\n const site = siteOf(x);\n const values = x.args.map(expr);\n const out = name(n);\n const label = `S${siteLabels++}`;\n const [self, ...args] = values as [string, ...string[]];\n const d = domain(f.domain);\n lines.push(`${indent}${label}: {`);\n let inner: string;\n let invoked: string;\n if (f.method) {\n const m = `m${label}`;\n lines.push(`${indent} if (typeof ${self} === \"object\" && ${self} !== null) {`, `${indent} const ${m} = ${site}.m;`);\n lines.push(`${indent} if (${m} !== undefined && ${self}[${expr(constant(x.name))}] === ${m} && ${d}.is(${self})) {`);\n inner = `${indent} `;\n invoked = `${self}[${expr(constant(x.name))}](${args.join(\", \")})`;\n } else {\n sites.set(`${site}_f`, `${site}.fn`);\n lines.push(`${indent} if (${d}.is(${self})) {`);\n inner = `${indent} `;\n invoked = `${site}_f(${values.join(\", \")})`;\n }\n const lifted = args.filter((_a, i) => liftsAt(f.lift, i)).map((a) => `typeof ${a} === \"number\"`);\n if (lifted.length > 0) lines.push(`${inner}if (${lifted.join(\" || \")}) { ${out} = ${generic(x, site, values)}; break ${label}; }`);\n const kinds = args.flatMap((a, i) => kindCheck(f.params?.[i], a, d));\n if (kinds.length > 0) lines.push(`${inner}if (!(${kinds.join(\" && \")})) { ${out} = ${generic(x, site, values)}; break ${label}; }`);\n attempt(invoked, inner);\n resultChecks(out, facts.checks, inner);\n lines.push(`${inner}break ${label};`);\n if (f.method) lines.push(`${indent} }`);\n lines.push(`${indent} }`, `${indent} ${out} = ${generic(x, site, values)};`, `${indent}}`);\n };\n // The statement of a failure (docs/COMPILER.md §4.1). A failure that keeps its error always has one (`keeps`).\n const action = (f: Fail, error: LExpr | undefined): string => {\n switch (f.t) {\n case \"return\":\n return `return ${expr(call(\"raise\", error as LExpr))};`;\n case \"stop\":\n return \"return F;\";\n case \"break\":\n return f.keep === undefined ? `break L${f.label};` : `{ ${name(f.keep)} = ${expr(error as LExpr)}; break L${f.label}; }`;\n case \"continue\":\n return f.strict === undefined ? `continue L${f.label};` : `{ if (${expr(f.strict.cond)}) ${action(f.strict.else, error)} continue L${f.label}; }`;\n }\n };\n const lines: string[] = [];\n const stmts = (ss: readonly LStmt[], indent: string): void => {\n for (const s of ss) stmt(s, indent);\n };\n const stmt = (s: LStmt, indent: string): void => {\n switch (s.t) {\n case \"let\":\n case \"set\":\n if (s.value.t === \"op\" && siteBlock(s.n, s.value, indent)) return;\n lines.push(`${indent}${name(s.n)} = ${expr(s.value)};`);\n return;\n case \"check\":\n lines.push(`${indent}if (!(${expr(s.ok)})) ${action(s.fail, s.error)} // ${s.reason}`);\n return;\n case \"fail\":\n lines.push(`${indent}${action(s.fail, s.error)}`);\n return;\n case \"if\":\n lines.push(`${indent}if (${expr(s.cond)}) {`);\n stmts(s.yes, deeper(indent));\n if (s.no.length > 0) {\n lines.push(`${indent}} else {`);\n stmts(s.no, deeper(indent));\n }\n lines.push(`${indent}}`);\n return;\n case \"loop\": {\n const [a, i] = [name(s.array), name(s.index)];\n lines.push(`${indent}${a} = ${expr(s.over)};`);\n lines.push(`${indent}L${s.label}: for (${i} = 0; ${i} < ${a}.length; ${i}++) {`);\n lines.push(`${indent} ${name(s.item)} = ${a}[${i}];`);\n stmts(s.body, deeper(indent));\n lines.push(`${indent}}`);\n return;\n }\n case \"block\":\n lines.push(`${indent}L${s.label}: {`);\n stmts(s.body, deeper(indent));\n lines.push(`${indent}}`);\n return;\n case \"repeat\":\n lines.push(`${indent}L${s.label}: for (;;) {`);\n stmts(s.body, deeper(indent));\n lines.push(`${indent}}`);\n return;\n case \"break\":\n lines.push(`${indent}break L${s.label};`);\n return;\n case \"next\":\n lines.push(`${indent}continue;`);\n return;\n case \"push\":\n lines.push(`${indent}${name(s.n)}.push(${expr(s.value)});`);\n return;\n case \"return\":\n lines.push(`${indent}return ${expr(s.value)};`);\n return;\n }\n };\n stmts(p.body, \" \");\n const params = Array.from({ length: FIXED_LOCALS }, (_, n) => name(n));\n const locals = Array.from({ length: p.locals - FIXED_LOCALS }, (_, n) => name(n + FIXED_LOCALS));\n const head = [\n `\"use strict\";`,\n `const F = R.F;`,\n // The order is the order of the first use, so the same program gives the same source.\n ...[...used].map((fn) => `const ${fn}_ = R.${fn};`),\n ...[...constants].map((i) => `const k${i} = K[${i}];`),\n ...[...sites].map(([site, init]) => `const ${site} = ${init};`),\n ...[...domains].map((i) => `const d${i} = R.domain(${i});`),\n ...[...fns].map(([f, init]) => `const ${f} = ${init};`),\n ...(threw ? [`const threw_ = R.threw;`] : []),\n `return function vex(${params.join(\", \")}) {`,\n ...(locals.length > 0 ? [` let ${locals.join(\", \")};`] : []),\n ` try {`,\n ];\n const tail = [` } catch {`, ` return F;`, ` }`, `};`, ``];\n const text = [...head, ...lines, ...tail];\n return (indented ? text : text.map((line) => line.trimStart())).join(\"\\n\");\n}\n","/**\n * The lowering: a Vex expression becomes a program of the loop IR (docs/COMPILER.md §3.3). A list op over a direct\n * `each` becomes one loop with a running value, so it makes no list.\n *\n * Each value that the interpreter can give as an error has a check. The block of the check tells what a failure does\n * (`Fail`). A list op skips an error item, and an error in the first argument of `ifError` gives the second argument.\n * These contexts drop the error, so the check has no error site. In each other context, the check has the site of its\n * error, and the program ends with that error or a binding keeps it (`keeps`). Where the error has a use, a check without\n * a site stops the program with `FALLBACK`. `#DEPTH!` of an extension stops the program too (COMPILE.EXT).\n *\n * A check for a result that only tier 1 can give is no error, so no context drops it (`#decide`, V-071).\n *\n * After a failure, the interpreter still evaluates the later arguments of a node, and two errors give `#ARGS`. The value\n * path of generated code has no flags for this. A failure jumps to a copy of the later arguments (`#chain`), which only\n * the failure path reads. A copy uses flags, so the size of the code stays near the size of the program times its depth.\n */\nimport {\n addrExprs,\n axisExprs,\n children,\n errorText,\n isFieldName,\n joinKind,\n limitAxis,\n listOf,\n MAX_ITERATIONS,\n nestingError,\n shapeError,\n type Addr,\n type Axis,\n type ErrorText,\n type Expr,\n type ExprOf,\n type FixJoin,\n type Names,\n type PrimitiveKind,\n} from \"@mark1russell7/vex\";\nimport { factsOf, isFusedOp, MAX_CALLS, primitiveOf, type Facts, type FusedOp, type Schema } from \"./facts.ts\";\nimport { memoNodes } from \"./memo.ts\";\nimport {\n array,\n bool,\n call,\n constant,\n FALLBACK_EXPR,\n FIXED_LOCALS,\n keeps,\n local,\n num,\n ORIGIN,\n plainOf,\n prim,\n RETURN,\n SPACE,\n STOP,\n TABLES,\n VARS,\n type ErrorSite,\n type Fail,\n type LExpr,\n type LoopProgram,\n type LStmt,\n} from \"./loop.ts\";\nimport { placesRead, unshared } from \"./unshared.ts\";\n\n/** The error of an expression that the compiler cannot lower. Then the program operates in tier 1. */\nexport class Unsupported extends Error {}\n\n/**\n * A bound name: its value, and the flag that tells if its binding gave a value. Without a flag, it always does. After a\n * failure, `error` is the lazy error of the binding, if the context of the binding keeps it.\n */\ninterface Bound {\n readonly value: LExpr;\n readonly ok?: LExpr;\n readonly error?: LExpr;\n}\n\n/** A bound function: its node, the path of its node, and the scope of its binding. */\ninterface BoundFn {\n readonly fn: ExprOf<\"fn\">;\n readonly path: readonly number[];\n readonly scope: Scope;\n}\n\n/** The facts of the lexical position of a node: its space, its origin, its focus and its bound names. */\ninterface Scope {\n readonly space: LExpr;\n readonly origin: LExpr;\n readonly focus: LExpr;\n readonly env: ReadonlyMap<string, Bound>;\n /** The bound functions (FN.BIND): a call puts the body of its function at the place of the call. */\n readonly fns: ReadonlyMap<string, BoundFn>;\n /** The record at the focus. In a loop, it reads the record by its index (SPACE.RECORDS). */\n readonly rec: LExpr;\n /** The columns of the steps around the node (COMPILE.FIX): the last round of each name, and its join. */\n readonly columns: ReadonlyMap<string, FixColumn>;\n /** The index of the focus in the keys of the space, if the lowering knows it. A read of a column uses it. */\n readonly slot: LExpr | undefined;\n}\n\n/** A column in the step of its `fix`: the local of an array with the value of each row, and the join of the column. */\ninterface FixColumn {\n readonly local: LExpr;\n readonly join: FixJoin;\n}\n\n/** A list of statements, and what a failed check in it does. */\ninterface Block {\n readonly stmts: LStmt[];\n readonly fail: Fail;\n}\n\nconst block = (fail: Fail): Block => ({ stmts: [], fail });\n\n/**\n * The number of nodes that the failure paths of a program can copy. Past it, a node with two or more arguments that can\n * fail keeps no error, so tier 1 gives its result. Thus the size of the code has a limit.\n */\nexport const MAX_COPIED = 2000;\n\n/**\n * The number of arguments of a node that `#chain` takes. Each argument that can fail adds a level of blocks, and the\n * printer and the JavaScript parser recurse over the levels. A node with more arguments keeps no error.\n */\nexport const MAX_CHAINED = 64;\n\n/** This function gives the axis inside the `where` axes of an axis. */\nconst baseAxis = (a: Axis): Exclude<Axis, { readonly t: \"where\" }> => (a.t === \"where\" ? baseAxis(a.axis) : a);\n\n/** This function gives the tests of the `where` axes of an axis, from the inside out, as the interpreter applies them. */\nfunction whereTests(a: Axis): readonly Expr[] {\n const out: Expr[] = [];\n for (let x: Axis = a; x.t === \"where\"; x = x.axis) out.unshift(x.test);\n return out;\n}\n\n/** This function gives the number of children of an axis: its list, then the tests of `where`. */\nconst axisChildren = (a: Axis): number => whereTests(a).length + (listOf(a) === undefined ? 0 : 1);\n\n/** This function gives the `each` under the `let` expressions of a list argument, or `undefined`. */\nfunction eachUnderLets(e: Expr | undefined): ExprOf<\"each\"> | undefined {\n let x = e;\n while (x?.tag === \"let\") x = x.body;\n return x?.tag === \"each\" ? x : undefined;\n}\n\n/** The targets of a round of a column: each key of the space, with no address. */\nconst ROWS: Pick<ExprOf<\"each\">, \"axis\"> = { axis: { t: \"all\" } };\n\n/** The primitive operation of each join (FIX.JOIN). The checks of a row give each join a value of its kind. */\nconst JOINS = { or: \"||\", and: \"&&\", max: \"max\", min: \"min\" } as const;\n\n/** The kinds of the values of the primitive operations that always give a boolean. */\nconst BOOLEAN_PRIMS: ReadonlySet<string> = new Set([\"!\", \"===\", \"!==\", \"isNumber\", \"isBoolean\", \"isString\", \"isValue\", \"isObject\"]);\n\n/** The checks of the kinds of a schema. */\nconst KIND_CHECKS = { number: \"isNumber\", string: \"isString\", boolean: \"isBoolean\" } as const;\n\n/** This function gives the kind of two values in the branches of a form, if they have the same kind. */\nconst join = (a: PrimitiveKind | undefined, b: PrimitiveKind | undefined): PrimitiveKind | undefined => (a === b ? a : undefined);\n\n/**\n * This function lowers an expression into a program of the loop IR. It throws `Unsupported` for an expression it cannot\n * lower. The facts of the options decide the op of a site whose values have known kinds (KIND.STATIC).\n */\nexport function lower(expr: Expr, facts: Facts = factsOf({}), schema: Schema = {}): LoopProgram {\n // COMPILE.PLACES: the walks below take the time of the places, so the count comes first.\n const places = placesRead([expr]);\n if (places.error !== undefined) throw new Unsupported(places.error);\n // EVAL.SHAPE and EVAL.NESTING: tier 1 gives the error of a program that is not valid or that is nested too deep.\n const shape = shapeError(expr);\n if (shape !== undefined) throw new Unsupported(shape);\n const deep = nestingError(expr);\n if (deep !== undefined) throw new Unsupported(deep);\n const plain = unshared(expr, places.shares);\n const l = new Lowerer(memoNodes(plain, isFusedOp), facts, schema);\n const b = block(RETURN);\n const top: Scope = { space: local(SPACE), origin: local(ORIGIN), focus: local(ORIGIN), env: new Map(), fns: new Map(), rec: prim(\"get\", local(SPACE), local(ORIGIN)), columns: new Map(), slot: undefined };\n l.check(b, call(\"has\", local(SPACE), local(ORIGIN)), \"the origin is a key of the space\", l.site(b, top, { t: \"key\" }));\n const value = l.expr(plain, top, [], b);\n b.stmts.push({ t: \"return\", value });\n return { body: b.stmts, locals: l.locals, constants: l.constants };\n}\n\nclass Lowerer {\n locals = FIXED_LOCALS;\n labels = 0;\n memos = 0;\n /** The number of bodies of functions that the lowering put at calls (MAX_CALLS). A copy does not count. */\n #calls = 0;\n /** The depth of the copies of the failure paths around the lowering. Inside a copy, a node has no memo. */\n #copying = 0;\n /** The number of nodes that the copies have so far (MAX_COPIED). */\n #copied = 0;\n /** The answers of `#mayExt`, for each map of functions. */\n readonly #exts = new WeakMap<ReadonlyMap<string, BoundFn>, Map<Expr, boolean>>();\n readonly #memo: ReadonlyMap<Expr, readonly Expr[]>;\n /** The keys of the nodes of the memo whose code the lowering makes, with their values. */\n #keys: ReadonlyMap<Expr, Bound> = new Map();\n readonly #facts: Facts;\n readonly #schema: Schema;\n /** The kind of each local whose kind the lowering knows. A local gets its kind where it gets its value. */\n readonly #kinds = new Map<number, PrimitiveKind>();\n\n constructor(memo: ReadonlyMap<Expr, readonly Expr[]>, facts: Facts, schema: Schema) {\n this.#memo = memo;\n this.#facts = facts;\n this.#schema = schema;\n }\n\n /** This method gives the kind of a value, if the lowering knows it. */\n kindOf(x: LExpr): PrimitiveKind | undefined {\n if (x.t === \"const\") {\n const t = typeof this.constants[x.i];\n return t === \"number\" || t === \"string\" || t === \"boolean\" ? t : undefined;\n }\n if (x.t === \"local\") return this.#kinds.get(x.n);\n // The other values have no kind that the lowering knows.\n return x.t === \"prim\" && BOOLEAN_PRIMS.has(x.op) ? \"boolean\" : undefined;\n }\n\n /** This method gives a local the kind `kind`. A value that is not a local keeps its kind. */\n #typed(x: LExpr, kind: PrimitiveKind | undefined): LExpr {\n if (x.t === \"local\" && kind !== undefined) this.#kinds.set(x.n, kind);\n return x;\n }\n\n /**\n * This method checks the kind that the schema declares for a value. A failure is no error of the interpreter, so it\n * stops the program, and tier 1 evaluates it.\n */\n #declared(b: Block, x: LExpr, kind: PrimitiveKind | undefined, reason: string): LExpr {\n if (kind === undefined) return x;\n this.#decide(b, prim(KIND_CHECKS[kind], x), reason);\n return this.#typed(x, kind);\n }\n\n /**\n * This method adds a check whose failure is no error of the program. Tier 1 decides the result, so the check stops the\n * program in each block. `check` is for an error, and a context that catches an error drops its failure (V-071).\n */\n #decide(b: Block, ok: LExpr, reason: string): void {\n b.stmts.push({ t: \"check\", ok, reason, fail: STOP });\n }\n\n readonly constants: unknown[] = [];\n readonly #pool = new Map<unknown, number>();\n\n /** This method gives the index of the constant of a value. The same value has one constant. A map key does not tell 0 from -0, so -0 has its own. */\n index(value: unknown): number {\n // Stryker disable next-line UnaryOperator: with +0 as the special key, 0 and -0 still get different constants\n const k = Object.is(value, -0) ? NEGATIVE_ZERO : value;\n let i = this.#pool.get(k);\n if (i === undefined) {\n i = this.constants.push(value) - 1;\n this.#pool.set(k, i);\n }\n return i;\n }\n\n /** This method gives the constant of a value. */\n constant(value: unknown): LExpr {\n return constant(this.index(value));\n }\n\n /** This method gives the number of a new local of a kind. */\n typedLocal(kind: PrimitiveKind): number {\n const n = this.locals++;\n this.#kinds.set(n, kind);\n return n;\n }\n\n /** This method gives a new local with a value. */\n value(b: Block, value: LExpr): LExpr {\n const n = this.locals++;\n b.stmts.push({ t: \"let\", n, value });\n return local(n);\n }\n\n /**\n * This method gives the lazy error of a site, where the block keeps it. `undefined` tells that the block drops the\n * error, so the site is not a constant of the program.\n */\n site(b: Block, s: Pick<Scope, \"origin\" | \"focus\">, site: ErrorSite, ...operands: LExpr[]): LExpr | undefined {\n return keeps(b.fail) ? call(\"err\", { t: \"site\", i: this.constants.push(site) - 1 }, s.origin, s.focus, ...operands) : undefined;\n }\n\n /** This method gives the lazy error of a text. */\n #text(b: Block, s: Scope, path: readonly number[], text: ErrorText): LExpr | undefined {\n return this.site(b, s, { t: \"text\", text, path });\n }\n\n /** This method adds a check. Without a lazy error, the failure is the plain failure of the block. */\n check(b: Block, ok: LExpr, reason: string, error?: LExpr): void {\n b.stmts.push(error === undefined ? { t: \"check\", ok, reason, fail: plainOf(b.fail) } : { t: \"check\", ok, reason, fail: b.fail, error });\n }\n\n /** This method gives a new local with the value of a call of the runtime, and a check that the value is not `FALLBACK`. */\n checked(b: Block, value: LExpr, reason: string, error?: LExpr): LExpr {\n const x = this.value(b, value);\n this.check(b, prim(\"!==\", x, FALLBACK_EXPR), reason, error);\n return x;\n }\n\n /** This method adds a failure: the interpreter always gives an error here. */\n fail(b: Block, error?: LExpr): LExpr {\n b.stmts.push(error === undefined ? { t: \"fail\", fail: plainOf(b.fail) } : { t: \"fail\", fail: b.fail, error });\n return FALLBACK_EXPR;\n }\n\n expr(e: Expr, s: Scope, path: readonly number[], b: Block): LExpr {\n // Inside a node of the memo, the value of a key replaces the key. An error of the key is an error at each place.\n const key = this.#keys.get(e);\n if (key !== undefined) {\n if (key.ok !== undefined) this.check(b, key.ok, \"a key with a value\");\n return key.value;\n }\n const keys = this.#copying > 0 ? undefined : this.#memo.get(e);\n return keys === undefined ? this.#node(e, s, path, b) : this.#memoized(e, keys, s, path, b);\n }\n\n /** This method lowers a copy of a part of a failure path. */\n #copy(make: () => void): void {\n this.#copying++;\n make();\n this.#copying--;\n }\n\n /** This method lowers a node itself, without the memo. */\n #node(e: Expr, s: Scope, path: readonly number[], b: Block): LExpr {\n if (this.#copying > 0) this.#copied++;\n switch (e.tag) {\n case \"lit\":\n return this.constant(e.value);\n case \"ref\":\n return this.#ref(e, s, path, b);\n case \"var\": {\n const bound = s.env.get(e.name);\n // A function is not a value (FN.VALUE): tier 1 gives the error. A name of a loop hides a function with its name.\n if (bound === undefined && s.fns.has(e.name)) return this.fail(b, this.#text(b, s, path, errorText.functionValue(e.name)));\n if (bound === undefined) {\n const x = this.checked(b, call(\"var\", local(VARS), this.constant(e.name)), \"a variable\", this.#text(b, s, path, errorText.unbound(e.name)));\n return this.#declared(b, x, primitiveOf(this.#schema.vars?.[e.name]), \"a variable of the schema\");\n }\n this.#read(b, bound, \"a binding with a value\");\n return bound.value;\n }\n case \"let\":\n return this.expr(e.body, { ...s, ...this.#bind(e, s, path, b) }, [...path, Object.keys(e.bind).length], b);\n // A function is only a binding of let, so the check of the shape stops this node first.\n // Stryker disable next-line all: see the comment above\n /* v8 ignore next -- @preserve */\n case \"fn\": return this.fail(b);\n case \"call\":\n return this.#call(e, s, path, b);\n case \"rec\": {\n const values = this.#all(Object.values(e.fields), s, path, 0, \"fields\", b);\n return this.value(b, call(\"rec\", this.constant(Object.keys(e.fields)), array(...values)));\n }\n case \"app\":\n return this.#app(e, s, path, b);\n case \"fold\":\n return this.#fold(e, s, path, b);\n case \"iterate\":\n return this.#iterate(e, s, path, b);\n case \"fix\":\n return this.#fix(e, s, path, b);\n case \"last\": {\n const column = s.columns.get(e.name);\n // The lowering comes before the checks. A read outside a step fails a check, and that check gives the reason.\n return column === undefined ? this.fail(b) : this.#rowOf(e.name, column, s, path, b);\n }\n case \"each\": {\n // A list keeps its error items, and generated code makes no error items. Thus an error item stops the program, and\n // tier 1 gives the list.\n const keys = this.locals++;\n const values = this.locals++;\n b.stmts.push({ t: \"let\", n: keys, value: array() }, { t: \"let\", n: values, value: array() });\n this.#loop(e, s, path, b, () => STOP, (body, key, v) => {\n body.stmts.push({ t: \"push\", n: keys, value: key }, { t: \"push\", n: values, value: v });\n });\n return this.value(b, call(\"list\", local(keys), local(values)));\n }\n case \"ext\": {\n // COMPILE.EXT: an error of an extension is an error of the block. The runtime throws for #DEPTH!, which stops the program.\n return this.checked(b, call(\"ext\", this.constant(e.kind), this.constant(e.data), s.space, s.origin, s.focus, this.constant(path)), \"an extension\", this.site(b, s, { t: \"ext\", kind: e.kind, path }));\n }\n }\n }\n\n /**\n * This method gives the value of a node that depends only on the space (§7.2). The memo has an entry for each space.\n * Without the entry of the space, the node evaluates in a block, and an error of it makes an entry without a value.\n * An exception stops the program, so the memo gets no entry for it.\n *\n * The entry has no error, because the error of a node depends on its position and on its child nodes. Where the context\n * keeps the error, a copy of the node evaluates after a read of such an entry. The copy gives the error at this position.\n * A node of the memo and its keys use no extension, so this second evaluation has no effect.\n */\n #memoized(e: Expr, keys: readonly Expr[], s: Scope, path: readonly number[], b: Block): LExpr {\n const memo: LExpr = { t: \"memo\", id: this.memos++ };\n // Each key evaluates here, in a block of its own, as a binding does.\n const values = keys.map((k): Bound => this.#attempt(b, (inner) => this.expr(k, s, path, inner), false));\n const tuple = array(...values.flatMap((k) => [k.value, flag(k)]));\n const h = this.locals++;\n const outer = this.#keys;\n this.#keys = new Map([...outer, ...keys.map((k, i): [Expr, Bound] => [k, values[i] as Bound])]);\n const compute = block(b.fail);\n const node = this.#attempt(compute, (inner) => this.#node(e, s, path, inner), false);\n this.#keys = outer;\n compute.stmts.push({ t: \"set\", n: h, value: prim(\"memoPut\", memo, s.space, tuple, node.value, flag(node)) });\n b.stmts.push({ t: \"let\", n: h, value: prim(\"memoGet\", memo, s.space, tuple) }, { t: \"if\", cond: prim(\"!\", prim(\"isValue\", local(h))), yes: compute.stmts, no: [] });\n const entry = prim(\"entryOk\", local(h));\n const stop: LStmt = { t: \"check\", ok: entry, reason: \"a value of the memo\", fail: plainOf(b.fail) };\n if (keeps(b.fail) && this.#copied < MAX_COPIED) {\n const copy = block(b.fail);\n this.#copy(() => this.#node(e, s, path, copy));\n b.stmts.push({ t: \"if\", cond: prim(\"!\", entry), yes: [...copy.stmts, stop], no: [] });\n } else {\n b.stmts.push(stop);\n }\n // Each entry of the memo comes from the code of the node, so it has the kind of the value of the node.\n return this.#typed(this.value(b, prim(\"entryValue\", local(h))), this.kindOf(node.value));\n }\n\n /**\n * This method lowers the arguments of an op or the fields of a record, with the child indexes from `first`. After an\n * error, the interpreter still evaluates the later arguments, and two errors give `#ARGS` (`#all` of the interpreter).\n * Where the context keeps the error of two or more arguments that can fail, `#chain` or `#collect` lowers them.\n *\n * An extension in a later argument can give `#DEPTH!`. Thus, where the program catches the error, each argument before\n * the last one that can use an extension has its own block (COMPILE.EXT). Then a failure skips no extension.\n */\n #all(xs: readonly Expr[], s: Scope, path: readonly number[], first: number, what: string, b: Block): LExpr[] {\n if (keeps(b.fail) && xs.filter((x) => x.tag !== \"lit\").length > 1) {\n if (this.#copying > 0) return this.#collect(xs, s, path, first, what, b);\n if (this.#copied < MAX_COPIED && xs.length <= MAX_CHAINED) return this.#chain(xs, s, path, first, what, b);\n return this.#all(xs, s, path, first, what, { stmts: b.stmts, fail: plainOf(b.fail) });\n }\n const last = b.fail.t === \"return\" || b.fail.t === \"stop\" ? -1 : xs.findLastIndex((x) => this.#mayExt(x, s.fns));\n const parts = xs.map((x, i): Bound => {\n const at = [...path, first + i];\n return i < last ? this.#attempt(b, (inner) => this.expr(x, s, at, inner)) : { value: this.expr(x, s, at, b) };\n });\n for (const x of parts) if (x.ok !== undefined) this.check(b, x.ok, \"an argument with a value\");\n return parts.map((x) => x.value);\n }\n\n /**\n * This method lowers arguments on the value path, with no new check. A failure of an argument keeps its error in a\n * local of the argument. It then jumps to the copy of the next argument that can fail. After the last copy, the errors\n * give the error of the node (`args` of the runtime). The copies clear the locals, for the next turn of a loop.\n *\n * Each argument evaluates once: the value path gives up at the failure, and the copies start after it.\n */\n #chain(xs: readonly Expr[], s: Scope, path: readonly number[], first: number, what: string, b: Block): LExpr[] {\n const end = this.labels++;\n const parts = xs.map((x, i) => {\n const label = this.labels++;\n const error = this.locals++;\n const part = block({ t: \"break\", label, keep: error });\n const at = [...path, first + i];\n return { x, at, label, error, value: this.expr(x, s, at, part), stmts: part.stmts };\n });\n const values = parts.map((p) => p.value);\n const failing = parts.filter((p) => p.stmts.length > 0);\n if (failing.length === 0) return values;\n let body: LStmt[] = [...parts.flatMap((p) => p.stmts), { t: \"break\", label: end }];\n failing.forEach((p, i) => {\n body = [{ t: \"block\", label: p.label, body }];\n const next = failing[i + 1];\n if (next === undefined) return;\n const label = this.labels++;\n const copy = block({ t: \"break\", label, keep: next.error });\n this.#copy(() => this.expr(next.x, s, next.at, copy));\n body.push({ t: \"block\", label, body: copy.stmts });\n });\n const inner = block(b.fail);\n const error = this.value(inner, this.#argsError(s, path, what, failing.map((p) => local(p.error))));\n inner.stmts.push(...failing.map((p): LStmt => ({ t: \"set\", n: p.error, value: { t: \"none\" } })));\n this.fail(inner, error);\n b.stmts.push({ t: \"block\", label: end, body: [...body, ...inner.stmts] });\n return values;\n }\n\n /**\n * This method lowers arguments in a copy. The value path does not read a copy, so each argument can have its own block\n * and its flag. A node in a copy thus adds no other copy, and the size of the code stays near the size of the node.\n */\n #collect(xs: readonly Expr[], s: Scope, path: readonly number[], first: number, what: string, b: Block): LExpr[] {\n const parts = xs.map((x, i): Bound => this.#attempt(b, (inner) => this.expr(x, s, [...path, first + i], inner)));\n const errors = parts.flatMap((p) => (p.ok === undefined ? [] : [prim(\"unless\", p.ok, p.value)]));\n if (errors.length > 0) {\n const error = this.value(b, this.#argsError(s, path, what, errors));\n this.check(b, prim(\"!\", prim(\"isValue\", error)), \"the arguments have values\", error);\n }\n return parts.map((p) => p.value);\n }\n\n /** This method gives the call of the runtime that makes the error of some arguments. */\n #argsError(s: Scope, path: readonly number[], what: string, errors: readonly LExpr[]): LExpr {\n const site = this.constants.push({ t: \"args\", what, path } satisfies ErrorSite) - 1;\n return call(\"args\", { t: \"site\", i: site }, s.origin, s.focus, array(...errors));\n }\n\n /**\n * This method tells if an expression can call an extension. A call reads the body of its function, and the bodies of\n * the functions of that body. A function cannot call itself, so the search ends. Each node has one answer for each\n * map of functions, because functions can call each other many times (V-068).\n */\n #mayExt(e: Expr, fns: ReadonlyMap<string, BoundFn>): boolean {\n let answers = this.#exts.get(fns);\n if (answers === undefined) {\n answers = new Map();\n this.#exts.set(fns, answers);\n }\n const known = answers.get(e);\n if (known !== undefined) return known;\n const bound = e.tag === \"call\" ? fns.get(e.fn) : undefined;\n const answer = e.tag === \"ext\" || (bound !== undefined && this.#mayExt(bound.fn.body, bound.scope.fns)) || children(e).some((x) => this.#mayExt(x, fns));\n answers.set(e, answer);\n return answer;\n }\n\n /**\n * This method evaluates an expression in a block whose errors end the block, as a binding does. It gives the value\n * and the flag that tells if the value exists. Without statements, the expression always has a value, so it gets no\n * flag. With `keep`, a failure keeps its lazy error in the local of the value: only the failure path writes it there.\n */\n #attempt(b: Block, make: (inner: Block) => LExpr, keep = keeps(b.fail)): Bound {\n const label = this.labels++;\n const v = this.locals++;\n const attempt = block(keep ? { t: \"break\", label, keep: v } : { t: \"break\", label });\n const value = make(attempt);\n if (attempt.stmts.length === 0) return { value };\n const ok = this.locals++;\n this.#typed(local(v), this.kindOf(value));\n attempt.stmts.push({ t: \"set\", n: v, value }, { t: \"set\", n: ok, value: bool(true) });\n b.stmts.push({ t: \"let\", n: ok, value: bool(false) }, { t: \"block\", label, body: attempt.stmts });\n return keep ? { value: local(v), ok: local(ok), error: local(v) } : { value: local(v), ok: local(ok) };\n }\n\n /** This method adds the check of a read of a bound name. An error of the binding is the error of the read. */\n #read(b: Block, bound: Bound, reason: string): void {\n if (bound.ok !== undefined) this.check(b, bound.ok, reason, bound.error);\n }\n\n /**\n * This method reads a field, as `ref` of the interpreter: the record of the key, and then each segment of the path.\n * A segment that cannot name a field always gives an error.\n */\n #ref(e: ExprOf<\"ref\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const moved = e.at === undefined || e.at.length === 0 ? undefined : this.#address(e.at, s, path, 0, b);\n const key = moved ?? s.focus;\n const missing = (where: string): LExpr | undefined => this.site(b, s, { t: \"missing\", where, path }, key);\n const n = this.locals++;\n const x = local(n);\n b.stmts.push({ t: \"let\", n, value: moved === undefined ? s.rec : prim(\"get\", s.space, moved) });\n this.check(b, prim(\"isValue\", x), \"a record\", missing(e.path.length === 0 ? \"(record)\" : e.path.join(\".\")));\n for (const [i, seg] of e.path.entries()) {\n const where = e.path.slice(0, i + 1).join(\".\");\n if (!isFieldName(seg)) return this.fail(b, missing(where));\n this.check(b, prim(\"isObject\", x), \"an object\", missing(where));\n b.stmts.push({ t: \"set\", n, value: prim(\"member\", x, this.constant(seg)) });\n this.check(b, prim(\"isValue\", x), \"a field\", missing(where));\n }\n const [field, ...more] = e.path;\n // Tier 2 knows only the primitive kinds. A value of a domain goes through the dispatch of the runtime.\n return field === undefined || more.length > 0 ? x : this.#declared(b, x, primitiveOf(this.#schema.fields?.[field]), \"a field of the schema\");\n }\n\n /**\n * This method binds the names of a `let`. The interpreter evaluates each binding in the scope outside the `let`. An\n * error of a binding is an error only where the body reads the name. Thus an error ends the block of the binding, and\n * a flag tells each read of the name that the binding has no value.\n */\n #bind(e: ExprOf<\"let\">, s: Scope, path: readonly number[], b: Block): Pick<Scope, \"env\" | \"fns\"> {\n const env = new Map(s.env);\n // A let with no function keeps the map of functions, so the answers of `#mayExt` for that map stay (V-089).\n const fns = Object.values(e.bind).some((x) => x.tag === \"fn\") ? new Map(s.fns) : undefined;\n Object.entries(e.bind).forEach(([name, x], i) => {\n // A function evaluates at each call. A binding sees the scope of the let, so a function cannot call itself.\n // A value hides a function of its name, because a read looks at the values first.\n if (x.tag === \"fn\") {\n fns?.set(name, { fn: x, path: [...path, i], scope: s });\n env.delete(name);\n } else {\n env.set(name, this.#attempt(b, (inner) => this.expr(x, s, [...path, i], inner)));\n }\n });\n return { env, fns: fns ?? s.fns };\n }\n\n /**\n * This method lowers a call (FN.CALL). The body of the function goes at the place of the call, with the values of the\n * arguments for its parameters. The body sees the names of the place of its binding.\n */\n #call(e: ExprOf<\"call\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const value = s.env.get(e.fn);\n if (value !== undefined) {\n this.#read(b, value, \"a binding with a value\");\n return this.fail(b, this.#text(b, s, path, errorText.notFunction(e.fn)));\n }\n const bound = s.fns.get(e.fn);\n // The name can be a variable of the run: only the run tells the error.\n if (bound === undefined) return this.fail(b, this.site(b, s, { t: \"call\", name: e.fn, path }, local(VARS)));\n if (bound.fn.params.length !== e.args.length) return this.fail(b, this.#text(b, s, path, errorText.arity(e.fn, bound.fn.params.length, e.args.length)));\n if (this.#copying === 0 && ++this.#calls > MAX_CALLS) throw new Unsupported(`the calls put the bodies of functions in more than ${String(MAX_CALLS)} places`);\n const env = new Map(bound.scope.env);\n bound.fn.params.forEach((p, i) => env.set(p, this.#attempt(b, (inner) => this.expr(e.args[i] as Expr, s, [...path, i], inner))));\n return this.expr(bound.fn.body, { ...s, env, fns: bound.scope.fns }, [...bound.path, 0], b);\n }\n\n #app(e: ExprOf<\"app\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const { op, args } = e;\n switch (op) {\n case \"if\":\n return this.#if(args, s, path, b);\n case \"and\":\n case \"or\":\n return args.length === 0 ? this.fail(b, this.#text(b, s, path, errorText.needsArguments(op))) : this.#andOr(op === \"or\", args, 0, s, path, b);\n case \"ifError\":\n return this.#ifError(args, s, path, b);\n }\n if (isFusedOp(op)) {\n const target = eachUnderLets(args[0]);\n if (target !== undefined) return this.#fused(op, e, target, s, path, b);\n }\n const values = this.#all(args, s, path, 0, \"arguments\", b);\n const kinds = values.map((x) => this.kindOf(x));\n // A static site checks the kind of its result, so the result has the kind that the op declares (KIND.RETURNS).\n const site = this.#facts.staticSite(op, kinds);\n const x = this.checked(b, { t: \"op\", name: this.index(op), args: values, kinds }, \"an op\", this.site(b, s, { t: \"op\", op, path }));\n return this.#typed(x, site?.t === \"fn\" ? primitiveOf(site.returns) : undefined);\n }\n\n /** The condition must be a boolean. Only the branch that the condition selects is evaluated. */\n #if(args: readonly Expr[], s: Scope, path: readonly number[], b: Block): LExpr {\n const [cond, yes, no] = args;\n if (cond === undefined) return this.fail(b, this.#text(b, s, path, errorText.needsArgument(\"if\", 0)));\n const c = this.#boolean(this.expr(cond, s, [...path, 0], b), b, s, { t: \"boolean\", op: \"if\", i: 0, path });\n const r = this.locals++;\n const kinds: (PrimitiveKind | undefined)[] = [];\n const branch = (x: Expr | undefined, i: number): LStmt[] => {\n const inner = block(b.fail);\n const value = x === undefined ? this.fail(inner, this.#text(inner, s, path, errorText.needsArgument(\"if\", i))) : this.expr(x, s, [...path, i], inner);\n kinds.push(this.kindOf(value));\n inner.stmts.push({ t: \"set\", n: r, value });\n return inner.stmts;\n };\n b.stmts.push({ t: \"if\", cond: c, yes: branch(yes, 1), no: branch(no, 2) });\n return this.#typed(local(r), join(kinds[0], kinds[1]));\n }\n\n /** `or` stops at the first `true`, and `and` at the first `false`. Each argument before the stop must be a boolean. */\n #andOr(isOr: boolean, args: readonly Expr[], i: number, s: Scope, path: readonly number[], b: Block, r = this.locals++): LExpr {\n const x = this.#boolean(this.expr(args[i] as Expr, s, [...path, i], b), b, s, { t: \"boolean\", op: isOr ? \"or\" : \"and\", i, path });\n this.#typed(local(r), \"boolean\");\n if (i === args.length - 1) {\n b.stmts.push({ t: \"set\", n: r, value: x });\n } else {\n const rest = block(b.fail);\n this.#andOr(isOr, args, i + 1, s, path, rest, r);\n const stop: LStmt[] = [{ t: \"set\", n: r, value: bool(isOr) }];\n b.stmts.push(isOr ? { t: \"if\", cond: x, yes: stop, no: rest.stmts } : { t: \"if\", cond: x, yes: rest.stmts, no: stop });\n }\n return local(r);\n }\n\n /**\n * The value of the first argument, or else the value of the second argument. An error of the first argument ends its\n * block. An exception, for example #DEPTH!, stops the program, so `ifError` does not hide it (EVAL.DEPTH).\n */\n #ifError(args: readonly Expr[], s: Scope, path: readonly number[], b: Block): LExpr {\n const [first, second] = args;\n if (first === undefined) return this.fail(b, this.#text(b, s, path, errorText.needsArgument(\"ifError\", 1)));\n const label = this.labels++;\n const r = this.locals++;\n const ok = this.locals++;\n const attempt = block({ t: \"break\", label });\n const value = this.expr(first, s, [...path, 0], attempt);\n attempt.stmts.push({ t: \"set\", n: r, value }, { t: \"set\", n: ok, value: bool(true) });\n const otherwise = block(b.fail);\n const fallback = second === undefined ? this.fail(otherwise, this.#text(otherwise, s, path, errorText.needsArgument(\"ifError\", 1))) : this.expr(second, s, [...path, 1], otherwise);\n otherwise.stmts.push({ t: \"set\", n: r, value: fallback });\n b.stmts.push({ t: \"let\", n: ok, value: bool(false) }, { t: \"block\", label, body: attempt.stmts }, { t: \"if\", cond: prim(\"!\", local(ok)), yes: otherwise.stmts, no: [] });\n return this.#typed(local(r), join(this.kindOf(value), this.kindOf(fallback)));\n }\n\n /** A value of a known kind needs no check. */\n #boolean(x: LExpr, b: Block, s: Pick<Scope, \"origin\" | \"focus\">, site: ErrorSite): LExpr {\n if (this.kindOf(x) !== \"boolean\") this.check(b, prim(\"isBoolean\", x), \"a boolean\", this.site(b, s, site, x));\n return x;\n }\n\n #number(x: LExpr, b: Block, s: Scope, site: ErrorSite): LExpr {\n if (this.kindOf(x) !== \"number\") this.check(b, prim(\"isNumber\", x), \"a number\", this.site(b, s, site, x));\n return x;\n }\n\n /**\n * This method lowers a list op over an `each` into one loop. Like the interpreter, the loop skips an error item, and\n * with the option `strict` the list op fails at an error item. `errors` gives the error values, so an error item of\n * `errors` stops the program.\n *\n * The loop checks the items in the order of the interpreter, so the first bad item is the item of the interpreter. Two\n * cases differ. With `strict`, the first error item of the whole list comes before a check of the op. With an extension\n * in the list, the interpreter evaluates each item before the op. In both cases, a check of the op keeps no error.\n * The later arguments evaluate before the loop, and the interpreter evaluates them after the list, so they keep no error.\n */\n #fused(op: FusedOp, e: ExprOf<\"app\">, target: ExprOf<\"each\">, s: Scope, path: readonly number[], b: Block): LExpr {\n // The `let` expressions above the `each`, from the outside in.\n let inner = s;\n let at = [...path, 0];\n for (let x = e.args[0] as Expr; x.tag === \"let\"; x = x.body) {\n inner = { ...inner, ...this.#bind(x, inner, at, b) };\n at = [...at, Object.keys(x.bind).length];\n }\n // COMPILE.EXT: the interpreter evaluates each item of the list before the op, and an extension in an item can give\n // #DEPTH!. Thus a failure that would skip the later items stops the program, if the list can call an extension.\n const skip: Block = this.#mayExt(e.args[0] as Expr, s.fns) ? { stmts: b.stmts, fail: STOP } : b;\n const plain: Block = { stmts: b.stmts, fail: plainOf(skip.fail) };\n const rest = this.#all(e.args.slice(1), s, path, 1, \"arguments\", plain);\n const options = op === \"reduce\" ? rest[1] : rest[0];\n const strict = options === undefined ? undefined : this.value(b, prim(\"===\", call(\"opts\", options), bool(true)));\n const name = rest[0];\n if (op === \"reduce\") {\n if (name === undefined) return this.fail(plain);\n this.check(plain, prim(\"isString\", name), \"an op name\");\n }\n const items = (label: number): Fail => {\n if (op === \"errors\") return STOP;\n return strict === undefined ? { t: \"continue\", label } : { t: \"continue\", label, strict: { cond: strict, else: skip.fail } };\n };\n const opFail = strict === undefined ? skip.fail : plain.fail;\n\n const acc = this.locals++;\n const n = this.typedLocal(\"number\");\n const init = (value: LExpr): void => {\n b.stmts.push({ t: \"let\", n: acc, value });\n };\n b.stmts.push({ t: \"let\", n, value: num(0) });\n const count = (body: Block): void => {\n body.stmts.push({ t: \"set\", n, value: prim(\"+\", local(n), num(1)) });\n };\n // A check of the list op itself is in the loop, but its failure is a failure of the list op.\n const opCheck = (body: Block): Block => ({ stmts: body.stmts, fail: opFail });\n const firstThen = (body: Block, v: LExpr, then: (later: Block) => LExpr): void => {\n const later = block(opFail);\n later.stmts.push({ t: \"set\", n: acc, value: then(later) });\n body.stmts.push({ t: \"if\", cond: prim(\"===\", local(n), num(0)), yes: [{ t: \"set\", n: acc, value: v }], no: later.stmts });\n };\n const nonEmpty = (): void => {\n this.check(b, prim(\"!==\", local(n), num(0)), \"a list that is not empty\", this.#text(b, s, path, errorText.empty(op)));\n };\n const opError = (): LExpr | undefined => this.site(b, s, { t: \"op\", op, path });\n const numbers: ErrorSite = { t: \"items\", op, what: \"numbers\", path };\n\n switch (op) {\n case \"count\":\n this.#loop(target, inner, at, b, items, (body) => count(body));\n return local(n);\n case \"sum\":\n case \"mean\":\n init(num(0));\n this.#loop(target, inner, at, b, items, (body, _key, v) => {\n body.stmts.push({ t: \"set\", n: acc, value: prim(\"+\", local(acc), this.#number(v, opCheck(body), s, numbers)) });\n count(body);\n });\n if (op === \"sum\") return this.#typed(this.checked(b, call(\"result\", local(acc)), \"a finite sum\", opError()), \"number\");\n nonEmpty();\n return this.#typed(this.checked(b, call(\"result\", prim(\"/\", local(acc), local(n))), \"a finite mean\", opError()), \"number\");\n case \"min\":\n case \"max\":\n this.#loop(target, inner, at, b, items, (body, _key, v) => {\n this.#number(v, opCheck(body), s, numbers);\n firstThen(body, v, () => prim(op, local(acc), v));\n count(body);\n });\n nonEmpty();\n return this.#typed(local(acc), \"number\");\n case \"any\":\n case \"all\":\n case \"none\":\n init(bool(op === \"all\"));\n this.#loop(target, inner, at, b, items, (body, _key, v) => {\n body.stmts.push({ t: \"set\", n: acc, value: prim(op === \"all\" ? \"&&\" : \"||\", local(acc), this.#boolean(v, opCheck(body), s, { t: \"items\", op, what: \"booleans\", path })) });\n });\n return op === \"none\" ? prim(\"!\", local(acc)) : this.#typed(local(acc), \"boolean\");\n case \"first\":\n this.#loop(target, inner, at, b, items, (body, _key, v) => {\n firstThen(body, v, () => local(acc));\n count(body);\n });\n nonEmpty();\n return local(acc);\n case \"values\":\n case \"keys\":\n init(array());\n this.#loop(target, inner, at, b, items, (body, key, v) => {\n body.stmts.push({ t: \"push\", n: acc, value: op === \"keys\" ? key : v });\n });\n return this.value(b, call(\"frozen\", local(acc)));\n case \"errors\":\n this.#loop(target, inner, at, b, items, () => undefined);\n return this.value(b, call(\"frozen\", array()));\n case \"reduce\":\n this.#loop(target, inner, at, b, items, (body, _key, v) => {\n firstThen(body, v, (later) => this.checked(later, call(\"step\", name as LExpr, local(acc), v), \"a step of reduce\", this.site(later, s, { t: \"step\", path }, name as LExpr)));\n count(body);\n });\n // An empty list can give the identity of the op, so tier 1 gives its result. Without one identity, it is an error.\n if (this.#emptyFails(e)) this.check(plain, prim(\"!==\", local(n), num(0)), \"a list that is not empty\");\n else this.#decide(b, prim(\"!==\", local(n), num(0)), \"a list that is not empty\");\n return local(acc);\n }\n }\n\n /**\n * This method tells if a `reduce` of an empty list always gives an error (LIST.EMPTY). The name of its op is a literal,\n * and the domains do not have exactly one identity of the op. An option can name a domain, so a third argument tells nothing.\n */\n #emptyFails(e: ExprOf<\"app\">): boolean {\n const name = e.args[1] as Expr;\n return e.args.length === 2 && name.tag === \"lit\" && this.#facts.identities(name.value as string) !== 1;\n }\n\n /**\n * This method lowers the loop over the targets of an axis. The tests of `where` and the body evaluate at each target\n * in a block whose failure is `items(label)`. Then `onItem` adds the statements for the value of the body.\n */\n /**\n * This method gives the key of an address. The expressions of its computed moves evaluate first, at the position of\n * the node, and their child indexes start at `first` (NAV.COMPUTED).\n */\n #address(at: Addr, s: Scope, path: readonly number[], first: number, b: Block): LExpr {\n const values = addrExprs(at).map((x, i) => this.expr(x, s, [...path, first + i], b));\n const moves = values.length === 0 ? [] : [array(...values)];\n return this.checked(b, call(\"addr\", s.space, s.origin, s.focus, this.constant(at), ...moves), \"an address\", this.site(b, s, { t: \"addr\", at, path }, s.space, ...moves));\n }\n\n #loop(e: ExprOf<\"each\">, s: Scope, path: readonly number[], b: Block, items: (label: number) => Fail, onItem: (body: Block, key: LExpr, value: LExpr) => void): void {\n this.#targetLoop(e, s, path, 1, b, items, (body, key, at, names) => {\n onItem(body, key, this.expr(e.body, { ...at, env: new Map([...at.env, ...names]) }, [...path, 0], body));\n });\n }\n\n /**\n * This method lowers the loop over the targets of an axis with an address. The list of the axis `list` has the child\n * index `firstTest`. The tests of `where` come next, and the expressions of the address come after them. `each` adds\n * the statements of a target. The map `names` has the names `as` of the item. Only the body or the step reads them.\n */\n #targetLoop(\n e: Pick<ExprOf<\"each\">, \"axis\" | \"at\" | \"as\">,\n s: Scope,\n path: readonly number[],\n firstTest: number,\n b: Block,\n items: (label: number) => Fail,\n each: (body: Block, key: LExpr, at: Scope, names: ReadonlyMap<string, Bound>) => void,\n ): void {\n const { axis, at: addr, as } = e;\n const list = listOf(axis);\n const tests = firstTest + axisChildren(axis) - whereTests(axis).length;\n const from = addr === undefined || addr.length === 0 ? s.focus : this.#address(addr, s, path, firstTest + axisChildren(axis), b);\n const base = baseAxis(axis);\n let space = s.space;\n let over: LExpr;\n let skip: LExpr | undefined;\n // The index of the record of each target: the index of the loop, or else the index that the axis gives.\n let idx: LExpr | undefined;\n // The value and the position of each item of the axis list.\n let item: { readonly values: LExpr; readonly nth: LExpr } | undefined;\n if (list !== undefined) {\n // The list evaluates at the key of the address (AXIS.LIST).\n const moved: Scope = from === s.focus ? s : { ...s, focus: from, rec: prim(\"get\", s.space, from), slot: undefined };\n const value = this.value(b, this.expr(list, moved, [...path, firstTest], b));\n const targets = this.checked(b, call(\"items\", value, bool(base.t === \"reverse\")), \"a list of the axis list\", this.site(b, moved, { t: \"listAxis\", path }, value));\n over = prim(\"keysOf\", targets);\n item = { values: prim(\"valuesOf\", targets), nth: prim(\"idxOf\", targets) };\n } else if (base.t === \"table\") {\n // The axis table moves the evaluation to the space of its table, and there the origin is the target.\n space = this.checked(b, call(\"table\", local(TABLES), this.constant(base.name)), \"a table\", this.#text(b, s, path, errorText.noTable(base.name)));\n over = call(\"keys\", space);\n } else if (base.t === \"all\" || base.t === \"others\") {\n over = call(\"keys\", s.space);\n if (base.t === \"others\") skip = from;\n } else {\n const targets = this.checked(b, { t: \"targets\", axis: this.index(base), args: [s.space, s.origin, from] }, \"the targets of an axis\", this.site(b, s, { t: \"axis\", axis: base, path }, s.space, from));\n over = prim(\"keysOf\", targets);\n idx = this.value(b, prim(\"idxOf\", targets));\n }\n // A key of a list can be outside the space, and it has no index of the space, so the record comes from the key.\n const records = list === undefined ? this.value(b, prim(\"records\", space)) : undefined;\n const label = this.labels++;\n const array_ = this.locals++;\n const index = this.locals++;\n const target = this.locals++;\n const key = local(target);\n const body = block(items(label));\n if (skip !== undefined) body.stmts.push({ t: \"if\", cond: prim(\"===\", key, skip), yes: [{ t: \"next\" }], no: [] });\n const slot = idx === undefined ? local(index) : prim(\"member\", idx, local(index));\n const rec = records === undefined ? prim(\"get\", space, key) : prim(\"recordAt\", records, slot, space, key);\n const at: Scope = { space, origin: base.t === \"table\" ? key : s.origin, focus: key, env: s.env, fns: s.fns, rec, columns: s.columns, slot: list === undefined ? slot : undefined };\n whereTests(axis).forEach((test, i) => {\n const testPath = [...path, tests + i];\n const ok = this.#boolean(this.expr(test, at, testPath, body), body, at, { t: \"test\", path: testPath });\n body.stmts.push({ t: \"if\", cond: prim(\"!\", ok), yes: [{ t: \"next\" }], no: [] });\n });\n const names = new Map<string, Bound>();\n const [name, position] = as ?? [];\n if (name !== undefined && item !== undefined) names.set(name, { value: this.value(body, prim(\"member\", item.values, local(index))) });\n if (position !== undefined && item !== undefined) names.set(position, { value: this.#typed(this.value(body, prim(\"member\", item.nth, local(index))), \"number\") });\n each(body, key, at, names);\n b.stmts.push({ t: \"loop\", label, item: target, index, array: array_, over, body: body.stmts });\n }\n\n /** This method gives a local for each name of a loop, with its first value at the node (LOOP.NAMES). */\n #loopNames(init: Names, s: Scope, path: readonly number[], b: Block): { readonly env: ReadonlyMap<string, Bound>; readonly locals: ReadonlyMap<string, number> } {\n const env = new Map(s.env);\n const locals = new Map<string, number>();\n Object.entries(init).forEach(([name, x], i) => {\n const value = this.expr(x, s, [...path, i], b);\n const n = this.locals++;\n b.stmts.push({ t: \"let\", n, value });\n this.#typed(local(n), this.kindOf(value));\n env.set(name, { value: local(n) });\n locals.set(name, n);\n });\n return { env, locals };\n }\n\n /**\n * This method lowers one step of a loop: each new value first, and then each name gets its value. A name keeps the\n * kind of its first value, so a new value of another kind stops the program, and tier 1 evaluates it.\n */\n #loopStep(step: Names, s: Scope, path: readonly number[], first: number, b: Block, locals: ReadonlyMap<string, number>): void {\n const values = Object.entries(step).map(([name, x], i): [number, LExpr] => {\n const n = locals.get(name) as number;\n const value = this.value(b, this.expr(x, s, [...path, first + i], b));\n return [n, this.#declared(b, value, this.kindOf(local(n)), \"a value of the kind of a name of a loop\")];\n });\n for (const [n, value] of values) b.stmts.push({ t: \"set\", n, value });\n }\n\n /** This method lowers an iteration (ITERATE.LIMIT, ITERATE.UNTIL): a repeated block with a count of its steps. */\n #iterate(e: ExprOf<\"iterate\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const first = Object.keys(e.init).length;\n const tests = first + Object.keys(e.step).length;\n const { env, locals } = this.#loopNames(e.init, s, path, b);\n const inner: Scope = { ...s, env };\n const limit = this.#limit(e, s, path, tests, b);\n const untilAt = tests + axisChildren(limitAxis(e) ?? { t: \"all\" });\n const label = this.labels++;\n const k = this.typedLocal(\"number\");\n b.stmts.push({ t: \"let\", n: k, value: num(0) });\n const body = block(b.fail);\n if (e.until !== undefined) {\n const stop = this.#boolean(this.expr(e.until, inner, [...path, untilAt], body), body, inner, { t: \"until\", path: [...path, untilAt] });\n body.stmts.push({ t: \"check\", ok: prim(\"!\", stop), reason: \"the test until\", fail: { t: \"break\", label } });\n }\n // At the limit, an iteration without a test ends, and an iteration with a test fails.\n const more = prim(\"!==\", local(k), limit);\n if (e.until === undefined) body.stmts.push({ t: \"check\", ok: more, reason: \"the limit of iterate\", fail: { t: \"break\", label } });\n else this.check(body, more, \"the limit of iterate\", this.site(body, s, { t: \"limit\", path }, limit));\n this.#loopStep(e.step, inner, path, first, body, locals);\n body.stmts.push({ t: \"set\", n: k, value: prim(\"+\", local(k), num(1)) });\n b.stmts.push({ t: \"repeat\", label, body: body.stmts });\n return this.expr(e.result, inner, [...path, untilAt + (e.until === undefined ? 0 : 1)], b);\n }\n\n /**\n * This method lowers a fixed point (FIX.ROUNDS). The column is an array with the value of each key, in the order of\n * the keys. The rows of `init` give its first values, and each round makes the array of the next values. A round\n * without a change ends the loop with the old array, as the interpreter does. After the last round, an error stops\n * the column (FIX.LIMIT). The value of the node is the row of the focus.\n */\n #fix(e: ExprOf<\"fix\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const n = this.locals++;\n const column: FixColumn = { local: local(n), join: e.join };\n b.stmts.push({ t: \"let\", n, value: array() });\n this.#rows(e, e.init, s, path, 0, b, (row, _at, v) => {\n row.stmts.push({ t: \"push\", n, value: v });\n });\n const limit = this.value(b, call(\"rounds\", s.space));\n const label = this.labels++;\n const k = this.typedLocal(\"number\");\n b.stmts.push({ t: \"let\", n: k, value: num(0) });\n const body = block(b.fail);\n this.check(body, prim(\"!==\", local(k), limit), \"the limit of the rounds\", this.site(body, s, { t: \"fixLimit\", name: e.name, path }, limit));\n const next = this.locals++;\n const changed = this.locals++;\n body.stmts.push({ t: \"let\", n: next, value: array() }, { t: \"let\", n: changed, value: bool(false) });\n // The step has the column in its scope, so an inner `fix` with the same name hides the column.\n this.#rows(e, e.step, { ...s, columns: new Map([...s.columns, [e.name, column]]) }, path, 1, body, (row, at, v) => {\n const old = this.value(row, prim(\"member\", column.local, at.slot as LExpr));\n const value = this.value(row, prim(JOINS[e.join], old, v));\n row.stmts.push({ t: \"if\", cond: prim(\"!==\", value, old), yes: [{ t: \"set\", n: changed, value: bool(true) }], no: [] }, { t: \"push\", n: next, value });\n });\n body.stmts.push(\n { t: \"check\", ok: local(changed), reason: \"a round that changes a row\", fail: { t: \"break\", label } },\n { t: \"set\", n, value: local(next) },\n { t: \"set\", n: k, value: prim(\"+\", local(k), num(1)) },\n );\n b.stmts.push({ t: \"repeat\", label, body: body.stmts });\n return this.#rowOf(e.name, column, s, path, b);\n }\n\n /**\n * This method lowers the evaluation of `x` at each row of a column. An error in a row does not stop the next rows, so\n * each extension of the round evaluates (FIX.ERROR). After the loop, the errors of the rows give the error of the\n * node. `each` adds the statements of a row with a good value.\n */\n #rows(e: ExprOf<\"fix\">, x: Expr, s: Scope, path: readonly number[], child: number, b: Block, each: (row: Block, at: Scope, value: LExpr) => void): void {\n const errors = this.locals++;\n b.stmts.push({ t: \"let\", n: errors, value: array() });\n const kind: ErrorSite = { t: \"row\", name: e.name, join: e.join, path };\n // Stryker disable next-line ArrowFunction: each check of a row is in its own block, so the loop reads no failure\n this.#targetLoop(ROWS, s, path, 0, b, () => b.fail, (body, _key, at) => {\n const row = this.#attempt(\n body,\n (inner) => {\n const v = this.value(inner, this.expr(x, at, [...path, child], inner));\n if (joinKind(e.join) === \"boolean\") this.#boolean(v, inner, at, kind);\n else this.check(inner, prim(\"isFinite\", v), \"a finite number\", this.site(inner, at, kind, v));\n each(inner, at, v);\n return v;\n },\n true,\n );\n body.stmts.push({ t: \"if\", cond: prim(\"!\", row.ok as LExpr), yes: [{ t: \"push\", n: errors, value: row.value }], no: [] });\n });\n const site = this.constants.push({ t: \"rows\", path } satisfies ErrorSite) - 1;\n this.check(b, prim(\"===\", prim(\"member\", local(errors), this.constant(\"length\")), num(0)), \"the rows have values\", call(\"args\", { t: \"site\", i: site }, s.origin, s.focus, local(errors)));\n }\n\n /** This method reads the row of the focus. A focus that is not a key of the space has no row (FIX.LAST). */\n #rowOf(name: string, column: FixColumn, s: Scope, path: readonly number[], b: Block): LExpr {\n const x = this.value(b, prim(\"member\", column.local, s.slot ?? call(\"rowIndex\", s.space, s.focus)));\n this.check(b, prim(\"isValue\", x), \"a row of the column\", this.site(b, s, { t: \"lastKey\", name, path }));\n return this.#typed(x, joinKind(column.join));\n }\n\n /**\n * This method gives the number of steps of an iteration. A data limit counts the targets of its axis. Its failure\n * stops the program, and tier 1 gives the error (ITERATE.LIMIT.ERROR).\n */\n #limit(e: ExprOf<\"iterate\">, s: Scope, path: readonly number[], firstTest: number, b: Block): LExpr {\n const axis = limitAxis(e);\n if (axis === undefined) return num(e.limit as number);\n const n = this.typedLocal(\"number\");\n b.stmts.push({ t: \"let\", n, value: num(0) });\n // The error of a limit that is not valid keeps its cause, so each failure here is the plain failure of the block.\n // COMPILE.EXT: the interpreter evaluates each test, and an extension in a test can give #DEPTH!. Thus a failed test stops the program.\n const plain: Block = { stmts: b.stmts, fail: axisExprs(axis).some((x) => this.#mayExt(x, s.fns)) ? STOP : plainOf(b.fail) };\n this.#targetLoop({ axis }, s, path, firstTest, plain, () => plain.fail, (body) => {\n body.stmts.push({ t: \"set\", n, value: prim(\"+\", local(n), num(1)) });\n });\n this.check(b, prim(\"===\", prim(\"min\", local(n), num(MAX_ITERATIONS)), local(n)), \"a data limit in the cap\");\n return local(n);\n }\n\n /** This method lowers a fold (FOLD.ORDER): the loop over the targets, with a step at each target. */\n #fold(e: ExprOf<\"fold\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const first = Object.keys(e.init).length;\n const tests = first + Object.keys(e.step).length;\n const { env, locals } = this.#loopNames(e.init, s, path, b);\n // An error of a test or of a step is the error of the fold.\n this.#targetLoop(e, s, path, tests, b, () => b.fail, (body, _key, at, names) => {\n this.#loopStep(e.step, { ...at, env: new Map([...env, ...names]) }, path, first, body, locals);\n });\n return this.expr(e.result, { ...s, env }, [...path, tests + axisChildren(e.axis) + addrExprs(e.at).length], b);\n }\n}\n\nconst NEGATIVE_ZERO = Symbol(\"-0\");\n\n/** This function gives the flag of a bound value: its local, or `true` for a value without a flag. */\n// Stryker disable next-line BooleanLiteral: a value without a flag always exists, so each constant gives the same entries\nconst flag = (b: Bound): LExpr => b.ok ?? bool(true);\n","/**\n * The runtime of generated code. Each function follows the rule of the interpreter of the core. Where the interpreter\n * gives an error value, the function gives `FALLBACK`, and it records the detail of the failure in two variables. On the\n * value path, the runtime makes no error values and no `Result` objects (docs/COMPILER.md §4.1). A list op on a list\n * value or an array is the exception: it runs the code of the interpreter (COMPILE.LIST.VALUE, COMPILE.LIST.ARRAY).\n *\n * The failure path of generated code keeps a lazy error: the site, the position and the operands. When the program ends\n * with it, `take` gives the error of the interpreter. It uses the error texts of the core (`materialize`).\n *\n * Generated code uses the runtime inside a `try`, and an exception gives `FALLBACK` for the whole program. Tier 1 then\n * gives the result. A function of the runtime catches an exception only where the interpreter makes a value of it. In\n * an op, it is `#CALC!`, and in `safeIs`, it is `false`. A full call stack is `#DEPTH!`, which no list op and no\n * `ifError` hides, so it goes on to the program. An extension throws for `#DEPTH!` too (COMPILE.EXT).\n */\nimport {\n axisTargets,\n errorAt,\n errorText,\n findMethod,\n fixRounds,\n fixValueError,\n isDepthError,\n isListOp,\n isStackOverflow,\n asList,\n isVexList,\n liftsAt,\n listOps,\n matchesKind,\n fixAddr,\n noKeyError,\n resolveAddr,\n safeIs,\n vexError,\n vexList,\n worstRow,\n type Addr,\n type AnyDomain,\n type Axis,\n type ErrorExtra,\n type ErrorText,\n type FixedMove,\n type FreeFn,\n type ParamKind,\n type Position,\n type Result,\n type Space,\n type VexError,\n} from \"@mark1russell7/vex\";\nimport { entryOf, type Entry, type Method, type Options } from \"./facts.ts\";\nimport type { ErrorSite } from \"./loop.ts\";\n\n/** The value of a program that stops at a failed check. */\nexport const FALLBACK: unique symbol = Symbol(\"vex.fallback\");\nexport type Fallback = typeof FALLBACK;\n\n/** The options that a runtime keeps: the domains, the free functions and the extension handlers. */\nexport type RuntimeOptions = Options;\n\n/**\n * The dispatch of one op name and one number of arguments. With up to 3 arguments, it takes the values themselves, the\n * receiver first. With more, it takes an array of the values. Generated code also reads its fields: the method of the\n * last receiver, the function of the op of the first domain, and the free function.\n */\nexport interface Site {\n (...values: never[]): unknown;\n m: Method | undefined;\n readonly fn: Method | undefined;\n readonly free: FreeFn | undefined;\n}\n\n/** A base axis: an axis that is not `where`. */\nexport type BaseAxis = Exclude<Axis, { readonly t: \"where\" }>;\n\n/** The targets of an axis at a focus: the keys, and the index of each key in `keys` of the space. */\nexport interface Targets {\n readonly keys: readonly string[];\n readonly idx: readonly (number | undefined)[];\n}\n\n/** The targets of the axis `list`: the key, the value and the position of each item, in the order of the loop. */\nexport interface ListTargets extends Targets {\n readonly values: readonly unknown[];\n}\n\n/** An entry of a memo: the value of a node for one space, or no value after an error. */\nexport interface MemoEntry {\n readonly v: unknown;\n readonly ok: boolean;\n}\n\n/**\n * The memo of one node: an entry for each space and each value of the keys (docs/COMPILER.md §7.2 and §7.3). An entry\n * with an object or a function in its keys is not kept, because each run can make a new one.\n */\nexport interface Memo {\n get(s: Space, keys: readonly unknown[]): MemoEntry | undefined;\n put(s: Space, keys: readonly unknown[], v: unknown, ok: boolean): MemoEntry;\n}\n\n/** A level of a memo: the entry of the keys so far, and the levels of the next key. */\ninterface MemoLevel {\n entry?: MemoEntry;\n next?: Map<unknown, MemoLevel>;\n}\n\n/** A map key does not tell 0 from -0, but an op can. Thus -0 has its own key. */\nconst NEGATIVE_ZERO = Symbol(\"-0\");\n\n/** This function tells if a memo keeps an entry with these keys: keys without objects and functions. */\nconst kept = (keys: readonly unknown[]): boolean => keys.every((k) => (typeof k !== \"object\" || k === null) && typeof k !== \"function\");\n\n/**\n * The detail of the failure of an op or of an extension, with the meaning of the two variables of the record:\n * - `threw`: an op threw, and `a` is the thrown value.\n * - `lift`: `fromScalar` threw. `a` is the thrown value, and `b` the name of the domain.\n * - `valid`: a check `valid` threw. `a` is the thrown value, and `b` the name of the domain.\n * - `bad`: a result failed its checks, and `a` is the result.\n * - `param`: an argument has the wrong kind, and `a` is a `ParamFailure`.\n * - `no-op`: no domain and no function has the op. `a` tells if the op has a receiver, and `b` is the receiver.\n * - `no-step`: no domain gives a step of `reduce`, and `a` is the accumulator.\n * - `no-handler`: an extension has no handler.\n * - `foreign`: a handler gave an error, and `a` is the error.\n * - `list`: a list op or `fill` gave an error of its own, and `a` is the error.\n */\ntype Detail = \"threw\" | \"lift\" | \"valid\" | \"bad\" | \"param\" | \"no-op\" | \"no-step\" | \"no-handler\" | \"foreign\" | \"list\";\n\n/** An argument of an op that does not have the kind of its parameter. */\ninterface ParamFailure {\n readonly index: number;\n readonly value: unknown;\n readonly kind: ParamKind;\n readonly domain: string;\n}\n\n/**\n * A failure that the program keeps: its site, its position, its operands and the detail of the runtime. `materialize`\n * makes the error of it only if the error is the result of the program.\n */\nexport interface LazyError {\n readonly site: ErrorSite;\n readonly origin: string;\n readonly focus: string;\n readonly operands: readonly unknown[];\n readonly detail: Detail;\n readonly a: unknown;\n readonly b: unknown;\n}\n\n/** The functions of the runtime. The names are the names of `RuntimeFn` in the loop IR. */\nexport interface Runtime {\n readonly F: Fallback;\n has(s: Space, key: string): boolean;\n /** This function gives the key of an address. `values` has the values of its computed moves (NAV.COMPUTED). */\n addr(s: Space, origin: string, focus: string, at: Addr, values?: readonly unknown[]): unknown;\n /**\n * This function gives the function of the targets of one base axis. A space does not change, so the targets stay in\n * a cache for each space and focus. Generated code gets it once, when it loads.\n */\n axis(axis: BaseAxis): (s: Space, origin: string, focus: string) => Targets | Fallback;\n table(tables: Readonly<Record<string, Space>> | undefined, name: string): unknown;\n keys(s: Space): readonly string[];\n /** This function gives the index of a key in the keys of a space, or `undefined` for a key outside the space. */\n rowIndex(s: Space, key: string): number | undefined;\n /** This function gives the largest number of rounds of a column of a space (FIX.LIMIT). */\n rounds(s: Space): number;\n /** This function gives the dispatch of an op name with `arity` arguments. Generated code gets it once, when it loads. */\n site(name: string, arity: number): Site;\n /** This function gives a new memo. Generated code gets one for each node of the memo, when it loads. */\n memo(): Memo;\n /** This function gives the domain at an index of the options. */\n domain(index: number): AnyDomain | undefined;\n /** An exception of an op is the error #CALC! of that op, so this function gives `FALLBACK`. A full call stack goes on. */\n threw(thrown: unknown): Fallback;\n /** This function records a result that failed its checks. It gives `FALLBACK`. */\n bad(value: unknown): Fallback;\n /** This function records an exception of the check `valid` of the domain at an index. It gives `FALLBACK`. */\n invalid(thrown: unknown, domain: number): Fallback;\n /** This function gives the lazy error of a failed check, with the record of the last failure. */\n err(site: ErrorSite, origin: string, focus: string, ...operands: readonly unknown[]): LazyError;\n /** This function gives the lazy error of the arguments that failed, as `#all` of the interpreter: `undefined` for no error. */\n args(site: ErrorSite, origin: string, focus: string, errors: readonly (LazyError | undefined)[]): LazyError | undefined;\n /** This function ends a program with a lazy error. It gives `FALLBACK`, so `load` keeps its contract. */\n raise(error: LazyError): Fallback;\n /** This function gives the error of the last `raise`, once. It gives `undefined` when the run ended in another way. */\n take(): VexError | undefined;\n step(name: string, acc: unknown, value: unknown): unknown;\n result(value: unknown): unknown;\n opts(value: unknown): unknown;\n rec(names: readonly string[], values: readonly unknown[]): unknown;\n list(keys: readonly string[], values: readonly unknown[]): unknown;\n /**\n * This function gives the targets of the axis `list` (AXIS.LIST): the keys, the values and the positions of the items.\n * A value that is not a list gives `FALLBACK`, and the site gives the error. Generated code makes no error item, so an\n * error item throws, and tier 1 gives the result.\n */\n items(value: unknown, reverse: boolean): ListTargets | Fallback;\n frozen(values: readonly unknown[]): unknown;\n ext(kind: string, data: unknown, s: Space, origin: string, focus: string, path: readonly number[]): unknown;\n var(vars: Readonly<Record<string, unknown>> | undefined, name: string): unknown;\n}\n\n/** The path and the position of a call of a list op. An error with this path is an error of the op, not of an item. */\nconst HERE: readonly number[] = [];\nconst NOWHERE: Position = { origin: \"\", focus: \"\" };\n\n/** The interpreter reads the own enumerable properties of the variables, with `Object.entries`. */\nconst hasVar = (vars: Readonly<Record<string, unknown>> | undefined, name: string): vars is Readonly<Record<string, unknown>> => vars !== undefined && Object.prototype.propertyIsEnumerable.call(vars, name);\n\n/** This function makes the runtime of one set of options. */\nexport function createRuntime(options: RuntimeOptions): Runtime {\n const domains = options.domains ?? [];\n const fns = options.fns;\n const extensions = options.extensions ?? {};\n const F: Fallback = FALLBACK;\n const lists = listOps(options);\n\n // The record of the last failure. Each failure writes it before `err` reads it, and a failure makes no object here.\n let detail: Detail = \"threw\";\n let detailA: unknown;\n let detailB: unknown;\n // The error of the last `raise`.\n let raised: LazyError | undefined;\n const record = (d: Detail, a?: unknown, b?: unknown): Fallback => {\n detail = d;\n detailA = a;\n detailB = b;\n return F;\n };\n\n // An exception of an op, of `fromScalar` or of a check `valid`.\n const failure = (d: Detail, thrown: unknown, domain?: string): Fallback => {\n if (isStackOverflow(thrown)) throw thrown;\n return record(d, thrown, domain);\n };\n const threw = (thrown: unknown): Fallback => failure(\"threw\", thrown);\n\n // The checks of the result of an op: a value, a finite number, and a valid value of its first domain.\n const checked = (value: unknown): unknown => {\n if (value === undefined || value === null) return record(\"bad\", value);\n if (typeof value === \"number\" && !Number.isFinite(value)) return record(\"bad\", value);\n for (const d of domains) {\n if (!safeIs(d, value)) continue;\n if (d.valid === undefined) return value;\n try {\n return d.valid(value) ? value : record(\"bad\", value);\n } catch (thrown) {\n return failure(\"valid\", thrown, d.name);\n }\n }\n return value;\n };\n\n // The call of an op, as `#call` of the interpreter: the lift of numbers, the kinds of the parameters, the call, and\n // the checks of the result.\n const invoke = (e: Entry, call: (args: readonly unknown[]) => unknown, rest: readonly unknown[]): unknown => {\n const lift = e.spec.liftScalar;\n const from = e.domain.fromScalar;\n let args = rest;\n if (lift && from !== undefined) {\n try {\n args = rest.map((a, i): unknown => (typeof a === \"number\" && liftsAt(lift, i) ? from(a) : a));\n } catch (thrown) {\n return failure(\"lift\", thrown, e.domain.name);\n }\n }\n const params = e.spec.params;\n if (params !== undefined) {\n const index = args.findIndex((a, i) => !matchesKind(params[i] ?? \"any\", a, e.domain));\n if (index !== -1) return record(\"param\", { index, value: args[index], kind: params[index] ?? \"any\", domain: e.domain.name } satisfies ParamFailure);\n }\n let value: unknown;\n try {\n value = call(args);\n } catch (thrown) {\n return threw(thrown);\n }\n return checked(value);\n };\n\n // The op of a name for a receiver: the first domain that accepts the receiver and has the op. `undefined` is no op.\n // `seen` receives each method that the dispatch finds.\n const dispatch = (entries: readonly (Entry | undefined)[], name: string, values: readonly unknown[], seen?: (m: Method) => void): unknown => {\n const [self, ...rest] = values;\n for (const e of entries) {\n if (e === undefined || !safeIs(e.domain, self)) continue;\n const fn = e.fn;\n if (fn !== undefined) return invoke(e, (args) => fn(self, ...args), rest);\n const method = findMethod(self, name);\n if (method === undefined) continue;\n seen?.(method);\n return invoke(e, (args) => method.apply(self, [...args]), rest);\n }\n return undefined;\n };\n\n const entriesOf = (name: string): readonly (Entry | undefined)[] => domains.map((d) => entryOf(d, name));\n\n // The result of a list op: the code of the interpreter, for each list (COMPILE.LIST.VALUE). An error of the op is an\n // error of the site. #DEPTH! and the error of an item stop the program, so tier 1 gives the result (V-064, V-066).\n const listResult = (r: Result<unknown>): unknown => {\n if (r.ok) return r.value;\n // Stryker disable next-line StringLiteral: the program catches the exception, so no one reads its message\n if (r.error.path !== HERE || isDepthError(r.error)) throw new Error(\"tier 1 gives the error of a list op\");\n return record(\"list\", r.error);\n };\n\n // The entries of the op names of reduce. A program can compute such a name, so the runtime keeps them by name.\n const stepEntries = new Map<string, readonly (Entry | undefined)[]>();\n\n // This function gives the error of a result that failed its checks, as `#checkResult` of the interpreter.\n const badText = (op: string, value: unknown): ErrorText => {\n if (value === undefined || value === null) return errorText.noValue(op);\n if (typeof value === \"number\" && !Number.isFinite(value)) return errorText.notFinite(op, value);\n // The checks of a domain gave this failure, so a domain accepts the value.\n return errorText.invalid(op, (domains.find((d) => safeIs(d, value)) as AnyDomain).name);\n };\n\n // This function gives the error of a failure of an op without a domain, as the end of `#app` of the interpreter.\n const noOpText = (op: string, receiver: boolean, self: unknown): ErrorText => {\n const accepted = receiver ? domains.find((d) => safeIs(d, self)) : undefined;\n if (accepted !== undefined) return errorText.domainNoOp(accepted.name, op);\n return receiver ? errorText.noDomain(op, self) : errorText.noOp(op);\n };\n\n // This function gives the error of a failure of the op `op`, from the record of the failure.\n const opError = (e: LazyError, op: string, path: readonly number[], at: (text: ErrorText, extra?: ErrorExtra) => VexError): VexError => {\n switch (e.detail) {\n case \"list\":\n return { ...(e.a as VexError), path, origin: e.origin, focus: e.focus };\n case \"threw\":\n return at(errorText.threw(op), { thrown: e.a });\n case \"lift\":\n return at(errorText.threw(`${e.b as string}.fromScalar`), { thrown: e.a });\n case \"valid\":\n return at(errorText.validThrew(op, e.b as string), { thrown: e.a });\n case \"bad\":\n return at(badText(op, e.a));\n case \"param\": {\n const p = e.a as ParamFailure;\n return at(errorText.badParam(op, p.index, p.value, p.kind, p.domain));\n }\n case \"no-step\":\n return at(errorText.noStep(op, e.a));\n // The two details of an extension have no op site, so this case is the only other detail.\n case \"no-op\":\n case \"foreign\":\n case \"no-handler\":\n return at(noOpText(op, e.a as boolean, e.b));\n }\n };\n\n // This function gives the error of an extension, as `#guard` and `#locate` of the interpreter.\n const extError = (e: LazyError, kind: string, pos: Position, path: readonly number[], at: (text: ErrorText, extra?: ErrorExtra) => VexError): VexError => {\n if (e.detail === \"threw\") return at(errorText.threw(kind), { thrown: e.a });\n if (e.detail === \"no-handler\") return at(errorText.noHandler(kind));\n const error = e.a as VexError;\n return error.origin === undefined ? { ...error, path, origin: pos.origin, focus: pos.focus } : error;\n };\n\n /** This function makes the error of a lazy error: the error of the interpreter, with the texts of the core. */\n const materialize = (e: LazyError): VexError => {\n const { site, operands } = e;\n if (site.t === \"key\") return noKeyError(e.origin);\n const pos = { origin: e.origin, focus: e.focus };\n const { path } = site;\n const at = (text: ErrorText, extra?: ErrorExtra): VexError => errorAt(text, pos, path, extra);\n const [first, second] = operands;\n switch (site.t) {\n case \"text\":\n return at(site.text);\n case \"call\": {\n const vars = first as Readonly<Record<string, unknown>> | undefined;\n return at(hasVar(vars, site.name) ? errorText.notFunction(site.name) : errorText.noFunction(site.name));\n }\n case \"missing\":\n return at(errorText.missing(first as string, site.where));\n case \"boolean\":\n return at(errorText.notBoolean(site.op, site.i, first));\n case \"items\":\n return at(errorText.needsItems(site.op, site.what, first));\n case \"until\":\n return at(errorText.untilKind(first));\n case \"limit\":\n return at(errorText.limit(first as number));\n case \"test\":\n return at(errorText.whereKind(first));\n case \"listAxis\":\n return at(errorText.axisList(first));\n case \"op\":\n return opError(e, site.op, path, at);\n case \"step\":\n return opError(e, first as string, path, at);\n case \"ext\":\n return extError(e, site.kind, pos, path, at);\n case \"addr\": {\n const values = second as readonly unknown[] | undefined;\n const fixed = values === undefined ? undefined : fixAddr(site.at, values, pos);\n if (fixed?.ok === false) return { ...fixed.error, path };\n const r = resolveAddr(first as Space, pos, fixed === undefined ? (site.at as readonly FixedMove[]) : fixed.value);\n return { ...(r as Extract<typeof r, { readonly ok: false }>).error, path };\n }\n case \"axis\": {\n const r = axisTargets(first as Space, { origin: e.origin, focus: second as string }, site.axis);\n return { ...(r as Extract<typeof r, { readonly ok: false }>).error, path };\n }\n case \"args\":\n return at(errorText.args(operands.length, site.what), { causes: (operands as readonly LazyError[]).map(materialize) });\n case \"fixLimit\":\n return at(errorText.fixLimit(site.name, first as number));\n case \"row\":\n return at(fixValueError(site.name, site.join, first) as ErrorText);\n case \"lastKey\":\n return at(errorText.lastKey(site.name, e.focus));\n case \"rows\": {\n const causes = (operands as readonly LazyError[]).map(materialize);\n return worstRow(causes) ?? at(errorText.args(causes.length, \"rows\"), { causes });\n }\n }\n };\n\n // The index of each key of a space, for the targets of an axis. A miss of the cache only makes the map again.\n const indexes = new WeakMap<Space, ReadonlyMap<string, number>>();\n const indexOf = (s: Space): ReadonlyMap<string, number> => {\n let m = indexes.get(s);\n // Stryker disable next-line ConditionalExpression: see the comment above\n if (m === undefined) {\n m = new Map(s.keys.map((k, i) => [k, i]));\n // Stryker disable next-line CallExpression: see the comment above\n indexes.set(s, m);\n }\n return m;\n };\n\n return {\n F,\n has: (s, key) => s.has(key),\n addr(s, origin, focus, at, values) {\n const pos = { origin, focus };\n // An address without computed moves has no values, and its moves are fixed.\n // Stryker disable next-line ConditionalExpression: fixAddr gives the same fixed moves, so the test only saves an array\n const fixed = values === undefined ? undefined : fixAddr(at, values, pos);\n if (fixed?.ok === false) return F;\n const r = resolveAddr(s, pos, fixed === undefined ? (at as readonly FixedMove[]) : fixed.value);\n return r.ok ? r.value : F;\n },\n axis(axis) {\n const cache = new WeakMap<Space, Map<string, Targets | Fallback>>();\n return (s, origin, focus) => {\n let byFocus = cache.get(s);\n if (byFocus === undefined) {\n byFocus = new Map();\n cache.set(s, byFocus);\n }\n let targets = byFocus.get(focus);\n if (targets === undefined) {\n const r = axisTargets(s, { origin, focus }, axis);\n const index = indexOf(s);\n targets = r.ok ? { keys: r.value, idx: r.value.map((k) => index.get(k)) } : F;\n byFocus.set(focus, targets);\n }\n return targets;\n };\n },\n table(tables, name) {\n const t = tables !== undefined && Object.hasOwn(tables, name) ? tables[name] : undefined;\n return t ?? F;\n },\n keys: (s) => s.keys,\n rowIndex: (s, key) => indexOf(s).get(key),\n rounds: (s) => fixRounds(s.keys.length),\n // The dispatch of `app` in the interpreter: the first domain that accepts the receiver and has the op, and else a\n // free function. Generated code has the fast path of each site, and it uses this dispatch for each other case.\n site(name, arity) {\n const entries = entriesOf(name);\n const listOp = isListOp(name);\n const fn = fns !== undefined && Object.hasOwn(fns, name) ? fns[name] : undefined;\n const generic = (values: readonly unknown[]): unknown => {\n if (listOp && isVexList(values[0])) return listResult(lists.list(name, values[0], values.slice(1), NOWHERE, HERE));\n if (values.length > 0) {\n const r = dispatch(entries, name, values, (m) => {\n site.m = m;\n });\n if (r !== undefined) return r;\n }\n // LIST.ARRAY: after the domains and the function of the host, a list op on an array is a list op on a list.\n if (listOp && fn === undefined && Array.isArray(values[0])) {\n const r = lists.array(name, values[0], values.slice(1), NOWHERE, HERE);\n // The value of `errors` has the position of the call, and a site has no position (COMPILE.LIST.ARRAY). FALLBACK\n // is an error, and a list op skips an error item, so an exception must stop the program (V-064).\n // Stryker disable next-line StringLiteral: the program catches the exception, so no one reads its message\n if (name === \"errors\" && r.ok && (r.value as readonly unknown[]).length > 0) throw new Error(\"tier 1 gives the errors of an array\");\n return listResult(r);\n }\n if (name === \"fill\" && fn === undefined) return listResult(lists.fill(values, NOWHERE, HERE));\n try {\n if (fn === undefined) return record(\"no-op\", values.length > 0, values[0]);\n return checked(fn(...values));\n } catch (thrown) {\n return threw(thrown);\n }\n };\n const call = arity <= 3 ? (...values: unknown[]): unknown => generic(values) : generic;\n const site: Site = Object.assign(call, { m: undefined, fn: entries.find((e) => e !== undefined)?.fn, free: fn });\n return site;\n },\n memo() {\n const spaces = new WeakMap<Space, MemoLevel>();\n // The level of a space and some keys. With `make`, the function makes each missing level. A level that a read\n // makes only uses memory, so the checks of `make` have no other effect.\n const level = (s: Space, keys: readonly unknown[], make: boolean): MemoLevel | undefined => {\n let at: MemoLevel | undefined = spaces.get(s);\n if (at === undefined) {\n // A read comes before each write, so the level of the space exists for each write.\n // Stryker disable next-line ConditionalExpression,BooleanLiteral: see the comments above\n if (!make) return undefined;\n at = {};\n spaces.set(s, at);\n }\n for (const k of keys) {\n // Stryker disable next-line UnaryOperator: with +0 as the special key, 0 and -0 still get different entries\n const slot = Object.is(k, -0) ? NEGATIVE_ZERO : k;\n let next: MemoLevel | undefined = at.next?.get(slot);\n if (next === undefined) {\n // Stryker disable next-line ConditionalExpression: see the comment above\n if (!make) return undefined;\n next = {};\n (at.next ??= new Map()).set(slot, next);\n }\n at = next;\n }\n return at;\n };\n return {\n // Stryker disable next-line BooleanLiteral: a read that makes the levels only uses memory\n get: (s, keys) => level(s, keys, false)?.entry,\n put(s, keys, v, ok) {\n const e = { v, ok };\n if (kept(keys)) (level(s, keys, true) as MemoLevel).entry = e;\n return e;\n },\n };\n },\n domain: (index) => domains[index],\n threw,\n bad: (value) => record(\"bad\", value),\n invalid: (thrown, domain) => failure(\"valid\", thrown, (domains[domain] as AnyDomain).name),\n err: (site, origin, focus, ...operands) => ({ site, origin, focus, operands, detail, a: detailA, b: detailB }),\n args(site, origin, focus, errors) {\n const failed = errors.filter((e) => e !== undefined);\n return failed.length < 2 ? failed[0] : { site, origin, focus, operands: failed, detail, a: undefined, b: undefined };\n },\n raise(error) {\n raised = error;\n return F;\n },\n take() {\n const e = raised;\n if (e === undefined) return undefined;\n raised = undefined;\n return materialize(e);\n },\n // One step of `reduce`: the first domain that accepts the accumulator and has the op. No free function.\n step(name, acc, value) {\n let entries = stepEntries.get(name);\n // Stryker disable ConditionalExpression,BlockStatement,CallExpression: a miss of the cache only reads the op tables again\n if (entries === undefined) {\n entries = entriesOf(name);\n stepEntries.set(name, entries);\n }\n // Stryker restore ConditionalExpression,BlockStatement,CallExpression\n return dispatch(entries, name, [acc, value]) ?? record(\"no-step\", acc);\n },\n result(value) {\n try {\n return checked(value);\n } catch (thrown) {\n return threw(thrown);\n }\n },\n // A list op reads the option `strict` of its options. The read can throw, as in the interpreter.\n opts: (value) => (value as { readonly strict?: unknown } | null | undefined)?.strict,\n // Object.fromEntries gives an own field for each name, also for \"__proto__\" (V-062).\n rec: (names, values) => Object.freeze(Object.fromEntries(names.map((n, i) => [n, values[i]]))),\n list: (keys, values) => vexList(keys.map((key, i) => ({ key, result: { ok: true, value: values[i] } }))),\n items(value, reverse) {\n // Stryker disable next-line ArrowFunction,StringLiteral: an error item throws below, so no one reads this error\n const listed = asList(value, (message) => vexError(\"kind-mismatch\", message, NOWHERE));\n if (listed === undefined) return F;\n const keys: string[] = [];\n const values: unknown[] = [];\n const idx: number[] = [];\n for (const { key, result } of listed.items) {\n // Stryker disable next-line StringLiteral: the program catches the exception, so no one reads its message\n if (!result.ok) throw new Error(\"tier 1 gives the axis list over an error item\");\n keys.push(key);\n values.push(result.value);\n idx.push(idx.length);\n }\n return reverse ? { keys: keys.toReversed(), values: values.toReversed(), idx: idx.toReversed() } : { keys, values, idx };\n },\n frozen: (values) => Object.freeze([...values]),\n ext(kind, data, s, origin, focus, path) {\n const handler = Object.hasOwn(extensions, kind) ? extensions[kind] : undefined;\n if (handler === undefined) return record(\"no-handler\");\n let r: ReturnType<typeof handler>;\n try {\n r = handler(data, { space: s, position: { origin, focus }, path });\n } catch (thrown) {\n // As for an op: an exception is #CALC!, and a full call stack goes on to the program.\n return threw(thrown);\n }\n if (r.ok) return r.value;\n // EVAL.DEPTH: no list op and no ifError hides #DEPTH!, so it stops the program as an exception (COMPILE.EXT).\n // Stryker disable next-line StringLiteral: the program catches the exception, so no one reads its message\n if (isDepthError(r.error)) throw new Error(\"an extension gave #DEPTH!\");\n return record(\"foreign\", r.error);\n },\n var: (vars, name) => (hasVar(vars, name) ? vars[name] : F),\n };\n}\n","/**\n * The tiers (docs/COMPILER.md §2.1). Tier 2 is generated JavaScript, and it gives its values and its error results. Tier\n * 1 is the closure compiler of the core, and it gives each result that tier 2 cannot give. Thus a tiered program gives\n * the results of the interpreter.\n */\nimport { compile, fail, fromDocument, isDocument, monotoneError, ok, sizeError, stepError, type CompileOptions, type Envelope, type Expr, type Program, type Space, type VexError } from \"@mark1russell7/vex\";\nimport { factsOf, type Schema } from \"./facts.ts\";\n\n/** The options of the compiler: the options of `compile`, and the schema of the host (docs/COMPILER.md §3.2). */\nexport type GenerateOptions = CompileOptions & { readonly schema?: Schema };\nimport { printJs } from \"./js.ts\";\nimport type { LoopProgram } from \"./loop.ts\";\nimport { lower, Unsupported } from \"./lower.ts\";\nimport { createRuntime, FALLBACK } from \"./runtime.ts\";\n\n/**\n * The output of `generate`: the loop IR and the source of a program, and the options that the source is for. Or else\n * the reason that the compiler cannot lower the program.\n */\nexport type Generated =\n | { readonly ok: true; readonly program: LoopProgram; readonly source: string; readonly options: GenerateOptions }\n | { readonly ok: false; readonly reason: string };\n\n/** A function of tier 2. It gives the value of the program, or `FALLBACK` for each other result. */\nexport type Tier2 = (space: Space, origin: string, vars: Readonly<Record<string, unknown>> | undefined, tables: Readonly<Record<string, Space>> | undefined) => unknown;\n\n/** This function gives the reason that tier 1 refuses a program with a good shape, or `undefined`. */\nconst refusal = (e: Expr, options: GenerateOptions): string | undefined => sizeError(e, options) ?? stepError(e, options) ?? monotoneError(e, options);\n\n/**\n * This function lowers an expression or a document and prints its source for the options (DOC.ENTRY). The op tables of\n * the domains give the fast path of each op site. It is pure, so a build can use it.\n */\nexport function generate(source: Expr | Envelope, options: GenerateOptions = {}): Generated {\n // DOC.ENTRY: a document gives its expression first, or the reason that it is not valid.\n const read = isDocument(source) ? fromDocument(source, options.domains) : ok(source);\n if (!read.ok) return { ok: false, reason: read.error.message };\n try {\n const facts = factsOf(options);\n const program = lower(read.value, facts, options.schema);\n // LOOP.SIZE, STEP.MAX: tier 2 refuses the programs that tier 1 refuses. The lowering checks the shape and the nesting first.\n const size = refusal(read.value, options);\n if (size !== undefined) return { ok: false, reason: size };\n return { ok: true, program, source: printJs(program, facts), options };\n } catch (thrown) {\n // A stack overflow in the lowering of a deep expression also goes to tier 1.\n return { ok: false, reason: thrown instanceof Unsupported ? thrown.message : \"the lowering threw an exception\" };\n }\n}\n\n/**\n * This function makes the function of tier 2 with `new Function`, with the options of the source. It throws on a page\n * that does not permit `new Function`.\n */\nexport function load(generated: Extract<Generated, { readonly ok: true }>): Tier2 {\n return link(generated).run;\n}\n\n/** This function loads a program, with the function that gives the error of a run that gave `FALLBACK`. */\nfunction link(generated: Extract<Generated, { readonly ok: true }>): { readonly run: Tier2; readonly take: () => VexError | undefined } {\n const runtime = createRuntime(generated.options);\n // oxlint-disable-next-line typescript/no-implied-eval -- the source comes from printJs, and it reads each name and literal from K (§5).\n const make = new Function(\"K\", \"R\", generated.source) as (k: readonly unknown[], r: ReturnType<typeof createRuntime>) => Tier2;\n return { run: make(generated.program.constants, runtime), take: () => runtime.take() };\n}\n\n/** The counts of the runs of a tiered program. */\nexport interface TierStats {\n /** The number of runs. */\n readonly runs: number;\n /** The number of runs where tier 2 gave no result, so tier 1 gave it. A run that tier 2 ends with an error is no fallback. */\n readonly fallbacks: number;\n}\n\n/** A program with tiers. It has the interface `Program` of the core, so it can replace a compiled program. */\nexport interface TieredProgram extends Program {\n /** The tier of the program: 2 when it has generated code, and else 1. */\n readonly tier: 1 | 2;\n /** The reason that the program has no generated code. */\n readonly reason?: string;\n readonly stats: TierStats;\n}\n\n/**\n * This function compiles an expression or a document into tier 2 if it can, and else into tier 1 (DOC.ENTRY). Tier 2\n * gives a value or an error. When it gives no result, tier 1 does that evaluation again. A run with a trace and\n * `explain` always use tier 1, because tier 2 makes no trace.\n */\nexport function tiered(source: Expr | Envelope, options: GenerateOptions = {}): TieredProgram {\n const slow = compile(source, options);\n // The program of tier 1 has the expression of a document, so tier 2 does not read the document again.\n const { expr } = slow;\n const generated = generate(expr, options);\n let fast: ReturnType<typeof link> | undefined;\n let reason: string | undefined;\n if (generated.ok) {\n try {\n fast = link(generated);\n } catch {\n reason = \"the page does not permit new Function\";\n }\n } else {\n reason = generated.reason;\n }\n const stats = { runs: 0, fallbacks: 0 };\n return {\n expr,\n tier: fast === undefined ? 1 : 2,\n ...(reason === undefined ? {} : { reason }),\n stats,\n run(r) {\n stats.runs++;\n if (fast === undefined || r.trace !== undefined) return slow.run(r);\n const value = fast.run(r.space, r.origin, r.vars, r.tables);\n if (value !== FALLBACK) return ok(value);\n const error = fast.take();\n if (error !== undefined) return fail(error);\n stats.fallbacks++;\n return slow.run(r);\n },\n explain: (r) => slow.explain(r),\n };\n}\n"],"mappings":";;;AAoMA,MAAa,SAAS,OAAsB;CAAE,GAAG;CAAS;AAAE;AAC5D,MAAa,YAAY,OAAsB;CAAE,GAAG;CAAS;AAAE;AAC/D,MAAa,OAAO,OAAsB;CAAE,GAAG;CAAO;AAAE;AACxD,MAAa,QAAQ,OAAuB;CAAE,GAAG;CAAQ;AAAE;AAC3D,MAAa,gBAAuB,EAAE,GAAG,WAAW;AACpD,MAAa,SAAe,OAAO,OAAO,EAAE,GAAG,SAAS,CAAC;AACzD,MAAa,OAAa,OAAO,OAAO,EAAE,GAAG,OAAO,CAAC;AACrD,MAAa,SAAS,GAAG,WAA2B;CAAE,GAAG;CAAS;AAAM;AACxE,MAAa,QAAQ,IAAY,GAAG,UAA0B;CAAE,GAAG;CAAQ;CAAI;AAAK;AACpF,MAAa,QAAQ,IAAe,GAAG,UAA0B;CAAE,GAAG;CAAQ;CAAI;AAAK;;AAGvF,SAAgB,MAAM,GAAkB;CACtC,QAAQ,EAAE,GAAV;EACE,KAAK,UACH,OAAO;EACT,KAAK,QACH,OAAO;EACT,KAAK,SACH,OAAO,EAAE,SAAS,KAAA;EACpB,KAAK,YACH,OAAO,EAAE,WAAW,KAAA,KAAa,MAAM,EAAE,OAAO,IAAI;CACxD;AACF;;AAGA,SAAgB,QAAQ,GAAe;CACrC,IAAI,EAAE,MAAM,YAAY,OAAO,EAAE,WAAW,KAAA,IAAY,IAAI;EAAE,GAAG;EAAG,QAAQ;GAAE,MAAM,EAAE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AC;AACzB;;AAGA,SAAS,KAAK,WAA0H;CACtI,MAAM,UAAU,cAAc,UAAU,OAAO;CAG/C,OAAO;EAAE,KAAK,IADG,SAAS,KAAK,KAAK,UAAU,MAC7B,CAAC,CAAC,UAAU,QAAQ,WAAW,OAAO;EAAG,YAAY,QAAQ,KAAK;CAAE;AACvF;;;;;;AAwBA,SAAgB,OAAO,QAAyB,UAA2B,CAAC,GAAkB;CAC5F,MAAM,OAAO,QAAQ,QAAQ,OAAO;CAEpC,MAAM,EAAE,SAAS;CACjB,MAAM,YAAY,SAAS,MAAM,OAAO;CACxC,IAAI;CACJ,IAAI;CACJ,IAAI,UAAU,IACZ,IAAI;EACF,OAAO,KAAK,SAAS;CACvB,QAAQ;EACN,SAAS;CACX;MAEA,SAAS,UAAU;CAErB,MAAM,QAAQ;EAAE,MAAM;EAAG,WAAW;CAAE;CACtC,OAAO;EACL;EACA,MAAM,SAAS,KAAA,IAAY,IAAI;EAC/B,GAAI,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO;EACzC;EACA,IAAI,GAAG;GACL,MAAM;GACN,IAAI,SAAS,KAAA,KAAa,EAAE,UAAU,KAAA,GAAW,OAAO,KAAK,IAAI,CAAC;GAClE,MAAM,QAAQ,KAAK,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM;GAC1D,IAAI,UAAU,UAAU,OAAO,GAAG,KAAK;GACvC,MAAM,QAAQ,KAAK,KAAK;GACxB,IAAI,UAAU,KAAA,GAAW,OAAO,KAAK,KAAK;GAC1C,MAAM;GACN,OAAO,KAAK,IAAI,CAAC;EACnB;EACA,UAAU,MAAM,KAAK,QAAQ,CAAC;CAChC;AACF"}
1
+ {"version":3,"file":"index.js","names":["NEGATIVE_ZERO","vars"],"sources":["../src/loop.ts","../src/js.ts","../src/lower.ts","../src/runtime.ts","../src/tiers.ts"],"sourcesContent":["import type { Addr, Axis, ErrorText, FixJoin, PrimitiveKind } from \"@mark1russell7/vex\";\n\n/**\n * The loop IR (docs/COMPILER.md §3.3): a small language of statements between the Vex IR and the back ends. It has\n * locals, loops over arrays, checks and the functions of the runtime. A back end reads only this IR.\n *\n * A check that fails stops the program with a lazy error, and a materialize step gives the error of the interpreter\n * (§4.1). Where the error has a use, a check that cannot name its error stops the program with the value `FALLBACK`, and\n * tier 1 evaluates it. A check with the failure `STOP` stops the program in each context, because its failure is no error.\n */\n\n/** The fixed locals of each program: the space, the origin, the variables and the tables of the run. */\nexport const SPACE = 0;\nexport const ORIGIN = 1;\nexport const VARS = 2;\nexport const TABLES = 3;\n/** The number of fixed locals. */\nexport const FIXED_LOCALS = 4;\n\n/** The functions of the runtime that generated code calls. Each one gives `FALLBACK` for a value it cannot give. */\nexport type RuntimeFn =\n | \"has\" // has(space, key): boolean\n | \"addr\" // addr(space, origin, focus, address, values?): the key of an address, with the values of its computed moves\n | \"table\" // table(tables, name): the space of a table\n | \"keys\" // keys(space): the keys of a space\n | \"rowIndex\" // rowIndex(space, key): the index of a key in the keys of a space, or undefined\n | \"rounds\" // rounds(space): the largest number of rounds of a column of the space (FIX.LIMIT)\n | \"step\" // step(name, acc, value): one step of reduce\n | \"result\" // result(value): the checks of the value of an op\n | \"opts\" // opts(value): the read of the option strict of a list op\n | \"rec\" // rec(names, values): a frozen record\n | \"list\" // list(keys, values): a list of an axis\n | \"items\" // items(value, reverse): the targets of the axis list, or FALLBACK for a value that is not a list\n | \"frozen\" // frozen(array): a frozen copy\n | \"ext\" // ext(kind, data, space, origin, focus, path): an extension\n | \"var\" // var(vars, name): a variable of the run\n | \"err\" // err(site, origin, focus, ...operands): the lazy error of a failed check\n | \"raise\" // raise(error): the end of the program with a lazy error\n | \"args\" // args(site, origin, focus, errors): the error of the arguments that failed, or undefined for no error\n | \"bad\" // bad(value): the record of a result of an op that failed its checks\n | \"invalid\"; // invalid(thrown, domain): the record of an exception of a check `valid`\n\n/** The primitive operations of the loop IR. They copy no arithmetic of a domain (§4.2). */\nexport type PrimOp =\n | \"+\" // the sum of a reduction, in the order of the interpreter\n | \"/\" // the mean of a reduction\n | \"===\"\n | \"!==\"\n | \"!\"\n | \"||\"\n | \"&&\"\n | \"min\" // Math.min, the minimum of a reduction\n | \"max\" // Math.max, the maximum of a reduction\n | \"isNumber\"\n | \"isFinite\" // Number.isFinite: a number that is not NaN and not an infinity\n | \"isBoolean\"\n | \"isString\"\n | \"isValue\" // not undefined and not null\n | \"isObject\" // an object or a function\n | \"unless\" // unless(ok, error): the error, or undefined when ok is true\n | \"get\" // get(space, key): the record of a key\n | \"member\" // member(object, name): the property of an object\n | \"records\" // records(space): the records of the space by index, or undefined (SPACE.RECORDS)\n | \"recordAt\" // recordAt(records, index, space, key): the record at an index, or else the record of the key\n | \"keysOf\" // keysOf(targets): the keys of the targets of an axis\n | \"idxOf\" // idxOf(targets): the index of each target in the keys of the space\n | \"valuesOf\" // valuesOf(targets): the value of each target of the axis list\n | \"memoGet\" // memoGet(memo, space, keys): the entry of a space and the values of its keys, or undefined\n | \"memoPut\" // memoPut(memo, space, keys, value, ok): the new entry of a space and the values of its keys\n | \"entryValue\" // entryValue(entry): the value of an entry of a memo\n | \"entryOk\"; // entryOk(entry): true if the entry has a value\n\n/** A value of the loop IR. */\nexport type LExpr =\n | { readonly t: \"const\"; readonly i: number }\n | { readonly t: \"local\"; readonly n: number }\n | { readonly t: \"num\"; readonly v: number }\n | { readonly t: \"bool\"; readonly v: boolean }\n | { readonly t: \"fallback\" }\n /** The value `undefined`: no error. */\n | { readonly t: \"none\" }\n /** The `ErrorSite` at the index `i` of the constants. Only a failure reads it. */\n | { readonly t: \"site\"; readonly i: number }\n | { readonly t: \"array\"; readonly items: readonly LExpr[] }\n | { readonly t: \"prim\"; readonly op: PrimOp; readonly args: readonly LExpr[] }\n | { readonly t: \"call\"; readonly fn: RuntimeFn; readonly args: readonly LExpr[] }\n /**\n * The dispatch of the op whose name is the constant `name`, with the values of its arguments, the receiver first.\n * `kinds` are the kinds of the values that the lowering knows (KIND.STATIC).\n */\n | { readonly t: \"op\"; readonly name: number; readonly args: readonly LExpr[]; readonly kinds: readonly (PrimitiveKind | undefined)[] }\n /** The memo `id` of the program: the value of one node for each space (§7.2). */\n | { readonly t: \"memo\"; readonly id: number }\n /** The targets of the base axis that is the constant `axis`, at the space, the origin and the focus of `args`. */\n | { readonly t: \"targets\"; readonly axis: number; readonly args: readonly [LExpr, LExpr, LExpr] };\n\n/**\n * The site of an error: the facts of the error that the lowering knows (docs/COMPILER.md §4.1). The operands of a\n * failure give the other facts. Each site has the path of its node, and `materialize` of the runtime reads it.\n */\nexport type ErrorSite =\n /** The origin is not a key of the space. */\n | { readonly t: \"key\" }\n /** The text does not depend on a value of the run. */\n | { readonly t: \"text\"; readonly text: ErrorText; readonly path: readonly number[] }\n /** A call of a name that is not a function here. Its operand is the variables of the run. */\n | { readonly t: \"call\"; readonly name: string; readonly path: readonly number[] }\n /** A reference that reads no value. Its operand is the key. */\n | { readonly t: \"missing\"; readonly where: string; readonly path: readonly number[] }\n /** An argument of a special form that is not a boolean. Its operand is the value. */\n | { readonly t: \"boolean\"; readonly op: string; readonly i: number; readonly path: readonly number[] }\n /** An item of a list op of the wrong kind. Its operand is the item. */\n | { readonly t: \"items\"; readonly op: string; readonly what: \"numbers\" | \"booleans\"; readonly path: readonly number[] }\n /** The test `until` of `iterate`, without a boolean. Its operand is the value. */\n | { readonly t: \"until\"; readonly path: readonly number[] }\n /** The limit of `iterate`, with no true value of the test. Its operand is the number of steps. */\n | { readonly t: \"limit\"; readonly path: readonly number[] }\n /** The round limit of a column, with rows that change. Its operand is the number of rounds. */\n | { readonly t: \"fixLimit\"; readonly name: string; readonly path: readonly number[] }\n /** A value of a row of the wrong kind, or a number that is not finite. Its operand is the value. */\n | { readonly t: \"row\"; readonly name: string; readonly join: FixJoin; readonly path: readonly number[] }\n /** A read of a column at a key that is not a row. */\n | { readonly t: \"lastKey\"; readonly name: string; readonly path: readonly number[] }\n /** Two or more rows of a round that failed (FIX.ERROR). Its operands are their errors. */\n | { readonly t: \"rows\"; readonly path: readonly number[] }\n /** The test of `where`, without a boolean. Its operand is the value. */\n | { readonly t: \"test\"; readonly path: readonly number[] }\n /** The axis `list` over a value that is not a list. Its operand is the value. */\n | { readonly t: \"listAxis\"; readonly path: readonly number[] }\n /** A failure of an op. The runtime recorded the detail of the failure. */\n | { readonly t: \"op\"; readonly op: string; readonly path: readonly number[] }\n /** A failure of a step of `reduce`. Its operand is the name of the op. */\n | { readonly t: \"step\"; readonly path: readonly number[] }\n /** A failure of an extension. The runtime recorded the detail of the failure. */\n | { readonly t: \"ext\"; readonly kind: string; readonly path: readonly number[] }\n /** An address that gives no key. Its operands are the space and the values of its computed moves. */\n | { readonly t: \"addr\"; readonly at: Addr; readonly path: readonly number[] }\n /** An axis that gives no targets. Its operands are the space and the focus. */\n | { readonly t: \"axis\"; readonly axis: Exclude<Axis, { readonly t: \"where\" }>; readonly path: readonly number[] }\n /** Two or more arguments or fields that failed. Its operands are their errors. */\n | { readonly t: \"args\"; readonly what: string; readonly path: readonly number[] };\n\n/**\n * What a failed check does. The interpreter gives an error value at the node of the check, and the context of the node\n * decides what happens to that error:\n *\n * - `return`: the program stops with the lazy error of the check.\n * - `stop`: the program stops with `FALLBACK`, and tier 1 evaluates it again. The check has no lazy error.\n * - `continue`: the item of a list op is an error item. The list op skips it, as the interpreter does. With the option\n * `strict`, the list op fails instead, and `strict.else` tells what that failure does.\n * - `break`: the block ends. For the first argument of `ifError`, the second argument then gives the value. With `keep`,\n * the local `keep` gets the lazy error, so a later read of it can stop the program.\n */\nexport type Fail =\n | { readonly t: \"return\" }\n | { readonly t: \"stop\" }\n | { readonly t: \"continue\"; readonly label: number; readonly strict?: { readonly cond: LExpr; readonly else: Fail } }\n | { readonly t: \"break\"; readonly label: number; readonly keep?: number };\n\n/** A statement of the loop IR. */\nexport type LStmt =\n /** A new local with a value. */\n | { readonly t: \"let\"; readonly n: number; readonly value: LExpr }\n /** A new value of a local. */\n | { readonly t: \"set\"; readonly n: number; readonly value: LExpr }\n /** When `ok` is false, the statement does `fail`. The reason names the check, and `error` is its lazy error. */\n | { readonly t: \"check\"; readonly ok: LExpr; readonly reason: string; readonly fail: Fail; readonly error?: LExpr }\n /** A check that fails always: the interpreter always gives an error here. */\n | { readonly t: \"fail\"; readonly fail: Fail; readonly error?: LExpr }\n | { readonly t: \"if\"; readonly cond: LExpr; readonly yes: readonly LStmt[]; readonly no: readonly LStmt[] }\n /**\n * A loop over the items of an array, in order. The local `array` holds the array, `index` the index, and `item` each\n * item. A `continue` with the label goes to the next item.\n */\n | { readonly t: \"loop\"; readonly label: number; readonly item: number; readonly index: number; readonly array: number; readonly over: LExpr; readonly body: readonly LStmt[] }\n /** A block with a label. A `break` with the label ends it. */\n | { readonly t: \"block\"; readonly label: number; readonly body: readonly LStmt[] }\n /** The end of the block with the label. */\n | { readonly t: \"break\"; readonly label: number }\n /** A loop with a label that repeats its body until a `break` with the label ends it. */\n | { readonly t: \"repeat\"; readonly label: number; readonly body: readonly LStmt[] }\n /** The next item of the innermost loop. */\n | { readonly t: \"next\" }\n /** A value at the end of an array. */\n | { readonly t: \"push\"; readonly n: number; readonly value: LExpr }\n | { readonly t: \"return\"; readonly value: LExpr };\n\n/** A program of the loop IR: its statements, the number of its locals and its constants. Each local is a name in the function. */\nexport interface LoopProgram {\n readonly body: readonly LStmt[];\n readonly locals: number;\n /** The constants, by index: literals, paths, addresses, axes and names. Generated code reads them by index (§5). */\n readonly constants: readonly unknown[];\n}\n\n// The constructors of the values of the loop IR.\nexport const local = (n: number): LExpr => ({ t: \"local\", n });\nexport const constant = (i: number): LExpr => ({ t: \"const\", i });\nexport const num = (v: number): LExpr => ({ t: \"num\", v });\nexport const bool = (v: boolean): LExpr => ({ t: \"bool\", v });\nexport const FALLBACK_EXPR: LExpr = { t: \"fallback\" };\nexport const RETURN: Fail = Object.freeze({ t: \"return\" });\nexport const STOP: Fail = Object.freeze({ t: \"stop\" });\nexport const array = (...items: LExpr[]): LExpr => ({ t: \"array\", items });\nexport const prim = (op: PrimOp, ...args: LExpr[]): LExpr => ({ t: \"prim\", op, args });\nexport const call = (fn: RuntimeFn, ...args: LExpr[]): LExpr => ({ t: \"call\", fn, args });\n\n/** This function tells if a failure uses the lazy error of its check. */\nexport function keeps(f: Fail): boolean {\n switch (f.t) {\n case \"return\":\n return true;\n case \"stop\":\n return false;\n case \"break\":\n return f.keep !== undefined;\n case \"continue\":\n return f.strict !== undefined && keeps(f.strict.else);\n }\n}\n\n/** This function gives the failure of a check without a lazy error. Where the error has a use, the program stops. */\nexport function plainOf(f: Fail): Fail {\n if (f.t === \"continue\") return f.strict === undefined ? f : { ...f, strict: { cond: f.strict.cond, else: plainOf(f.strict.else) } };\n return f.t === \"break\" && f.keep === undefined ? f : STOP;\n}\n","/**\n * The back end of JavaScript source (docs/COMPILER.md §3.4). It prints a program of the loop IR as the body of a\n * function with the parameters `K` (the constants) and `R` (the runtime).\n *\n * The source has no name and no literal of the program as text: it reads each one from `K`, by its index (§5). The\n * same program and the same facts always give the same source.\n *\n * With the facts of the options, each op site gets its fast path in the source (§13.2). Each site then has its own\n * inline caches in the engine, and a guard sends each other case to the dispatch of the runtime.\n */\nimport { liftsAt, type ParamKind } from \"@mark1russell7/vex\";\nimport { primitiveOf, type Facts, type SiteFacts, type StaticSite } from \"./facts.ts\";\nimport { call, constant, FIXED_LOCALS, type Fail, type LExpr, type LoopProgram, type LStmt, type RuntimeFn } from \"./loop.ts\";\n\ntype OpExpr = Extract<LExpr, { readonly t: \"op\" }>;\n\n/** This function gives the call of the dispatch of a site. With more than 3 values, the dispatch takes an array. */\nfunction generic(x: OpExpr, site: string, values: readonly string[]): string {\n return x.args.length <= 3 ? `${site}(${values.join(\", \")})` : `${site}([${values.join(\", \")}])`;\n}\n\n/** This function gives the check of an argument of the kind `kind`, for an op of the domain `d`. */\nfunction kindCheck(kind: ParamKind | undefined, a: string, d: string): readonly string[] {\n if (kind === \"domain\") return [`${d}.is(${a})`];\n if (kind === \"number\" || kind === \"boolean\" || kind === \"string\") return [`typeof ${a} === \"${kind}\"`];\n return [];\n}\n\nconst name = (n: number): string => `l${n}`;\n\n/**\n * This function prints the source of a program. The body gives the function of the program. The source of a compile has\n * no indent, so its size stays linear in the block nesting (COMPILE.SOURCE.SIZE). With `indented`, each line shows its\n * block. The golden files read that form, and the two forms differ only in the spaces at the start of a line.\n */\nexport function printJs(p: LoopProgram, facts: Facts, indented = false): string {\n const deeper = (indent: string): string => (indented ? `${indent} ` : indent);\n const used = new Set<RuntimeFn>();\n const constants = new Set<number>();\n const sites = new Map<string, string>();\n const domains = new Set<number>();\n // The functions of the ops of the static sites. They read the domains, so they come after them.\n const fns = new Map<string, string>();\n let threw = false;\n let siteLabels = 0;\n const expr = (x: LExpr): string => {\n switch (x.t) {\n case \"const\":\n constants.add(x.i);\n return `k${x.i}`;\n case \"local\":\n return name(x.n);\n case \"num\":\n case \"bool\":\n return String(x.v);\n case \"fallback\":\n return \"F\";\n case \"none\":\n return \"undefined\";\n case \"site\":\n return `K[${x.i}]`;\n case \"array\":\n return `[${x.items.map(expr).join(\", \")}]`;\n case \"call\":\n used.add(x.fn);\n return `${x.fn}_(${x.args.map(expr).join(\", \")})`;\n case \"op\":\n return generic(x, siteOf(x), x.args.map(expr));\n case \"memo\":\n sites.set(`mo${x.id}`, \"R.memo()\");\n return `mo${x.id}`;\n case \"targets\": {\n // An axis has one function of targets for each site, with its cache.\n const site = `a${x.axis}`;\n sites.set(site, `R.axis(${expr(constant(x.axis))})`);\n return `${site}(${x.args.map(expr).join(\", \")})`;\n }\n case \"prim\": {\n const [a, b, c, d, e] = x.args.map(expr);\n switch (x.op) {\n case \"!\":\n return `(!${a})`;\n case \"min\":\n case \"max\":\n return `Math.${x.op}(${a}, ${b})`;\n case \"isNumber\":\n return `(typeof ${a} === \"number\")`;\n case \"isFinite\":\n return `Number.isFinite(${a})`;\n case \"isBoolean\":\n return `(typeof ${a} === \"boolean\")`;\n case \"isString\":\n return `(typeof ${a} === \"string\")`;\n case \"isValue\":\n return `(${a} !== undefined && ${a} !== null)`;\n case \"isObject\":\n return `(typeof ${a} === \"object\" || typeof ${a} === \"function\")`;\n case \"unless\":\n return `(${a} ? undefined : ${b})`;\n case \"get\":\n return `${a}.get(${b})`;\n case \"member\":\n return `${a}[${b}]`;\n case \"records\":\n return `${a}.records`;\n case \"recordAt\":\n return `(${a} !== undefined ? ${a}[${b}] : ${c}.get(${d}))`;\n case \"keysOf\":\n return `${a}.keys`;\n case \"idxOf\":\n return `${a}.idx`;\n case \"valuesOf\":\n return `${a}.values`;\n case \"memoGet\":\n return `${a}.get(${b}, ${c})`;\n case \"memoPut\":\n return `${a}.put(${b}, ${c}, ${d}, ${e})`;\n case \"entryValue\":\n return `${a}.v`;\n case \"entryOk\":\n return `${a}.ok`;\n case \"+\":\n case \"/\":\n case \"===\":\n case \"!==\":\n case \"||\":\n case \"&&\":\n return `(${a} ${x.op} ${b})`;\n }\n }\n }\n };\n // An op has one dispatch for each name and number of arguments, and the function gets it when it loads.\n function siteOf(x: OpExpr): string {\n const site = `s${x.name}_${x.args.length}`;\n sites.set(site, `R.site(${expr(constant(x.name))}, ${x.args.length})`);\n return site;\n }\n const domain = (i: number): string => {\n domains.add(i);\n return `d${i}`;\n };\n // The record of a result that failed its checks. The result is `FALLBACK` after it.\n const bad = (out: string): string => {\n used.add(\"bad\");\n return `${out} = bad_(${out});`;\n };\n // The check `valid` of the domain at the index `i`, with the record of its failure.\n const validity = (out: string, i: number): string => {\n used.add(\"invalid\");\n return `try { if (!${domain(i)}.valid(${out})) ${bad(out)} } catch (e) { ${out} = invalid_(e, ${i}); }`;\n };\n // The checks of the result of an op, as `#checkResult` of the interpreter. A domain without `valid` stops the search.\n const resultChecks = (out: string, checks: readonly boolean[], indent: string): void => {\n lines.push(`${indent}if (${out} !== F) {`);\n lines.push(`${indent} if (${out} === undefined || ${out} === null || (typeof ${out} === \"number\" && !Number.isFinite(${out}))) ${bad(out)}`);\n checks.forEach((valid, i) => {\n lines.push(valid ? `${indent} else if (${domain(i)}.is(${out})) { ${validity(out, i)} }` : `${indent} else if (${domain(i)}.is(${out})) {}`);\n });\n lines.push(`${indent}}`);\n };\n /**\n * The fast path of an op site that assigns the local `n`. A method site guards the method of the last receiver and\n * the domain of the receiver, and a site of a function guards the domain. Then the site checks the arguments, calls\n * the op in a `try`, and checks the result. A number that the op lifts, and each failed guard, go to the dispatch.\n */\n const siteBlock = (n: number, x: OpExpr, indent: string): boolean => {\n const attempt = (invoked: string, ind: string): void => {\n threw = true;\n lines.push(`${ind}try { ${name(n)} = ${invoked}; } catch (e) { ${name(n)} = threw_(e); }`);\n };\n const st = facts.staticSite(p.constants[x.name] as string, x.kinds);\n if (st !== undefined) {\n staticBlock(n, x, st, indent, attempt);\n return true;\n }\n const f = facts.site(p.constants[x.name] as string, x.args.length);\n switch (f?.t) {\n case undefined:\n return false;\n case \"free\": {\n const site = siteOf(x);\n sites.set(`${site}_f`, `${site}.free`);\n attempt(`${site}_f(${x.args.map(expr).join(\", \")})`, indent);\n resultChecks(name(n), facts.checks, indent);\n return true;\n }\n case \"op\":\n opBlock(n, x, f, indent, attempt);\n return true;\n }\n };\n /**\n * The block of a static site (KIND.STATIC). The kinds of its values decide its op, so the site uses the function of the\n * op with no guard. A result of another kind breaks the declaration of the op. Then the program stops, and tier 1\n * evaluates it. An argument of a kind that the op does not accept goes to the dispatch, which gives the failure.\n */\n const staticBlock = (n: number, x: OpExpr, st: StaticSite, indent: string, attempt: (call: string, ind: string) => void): void => {\n const out = name(n);\n const values = x.args.map(expr);\n if (st.t === \"free\") {\n const site = siteOf(x);\n sites.set(`${site}_f`, `${site}.free`);\n attempt(`${site}_f(${values.join(\", \")})`, indent);\n resultChecks(out, facts.checks, indent);\n return;\n }\n if (st.bad) {\n lines.push(`${indent}${out} = ${generic(x, siteOf(x), values)};`);\n return;\n }\n const f = `f${x.name}_${st.domain}`;\n fns.set(f, `${domain(st.domain)}.ops[${expr(constant(x.name))}].fn`);\n attempt(`${f}(${values.join(\", \")})`, indent);\n // A local of tier 2 has a primitive kind or no kind (lower.ts). Thus a result of the kind of a domain gets the checks\n // of the interpreter, as a result of the kind any (V-059).\n const kind = primitiveOf(st.returns);\n if (kind === undefined) {\n resultChecks(out, facts.checks, indent);\n return;\n }\n lines.push(`${indent}if (${out} !== F && typeof ${out} !== \"${kind}\") return F; // the kind of the result`);\n if (kind === \"number\") lines.push(`${indent}if (${out} !== F && !Number.isFinite(${out})) ${bad(out)}`);\n const check = facts.checkOf(kind);\n if (check === undefined) resultChecks(out, facts.checks, indent);\n else if (facts.checks[check] === true) lines.push(`${indent}if (${out} !== F) { ${validity(out, check)} }`);\n };\n const opBlock = (n: number, x: OpExpr, f: Extract<SiteFacts, { readonly t: \"op\" }>, indent: string, attempt: (call: string, ind: string) => void): void => {\n const site = siteOf(x);\n const values = x.args.map(expr);\n const out = name(n);\n const label = `S${siteLabels++}`;\n const [self, ...args] = values as [string, ...string[]];\n const d = domain(f.domain);\n lines.push(`${indent}${label}: {`);\n let inner: string;\n let invoked: string;\n if (f.method) {\n const m = `m${label}`;\n lines.push(`${indent} if (typeof ${self} === \"object\" && ${self} !== null) {`, `${indent} const ${m} = ${site}.m;`);\n lines.push(`${indent} if (${m} !== undefined && ${self}[${expr(constant(x.name))}] === ${m} && ${d}.is(${self})) {`);\n inner = `${indent} `;\n invoked = `${self}[${expr(constant(x.name))}](${args.join(\", \")})`;\n } else {\n sites.set(`${site}_f`, `${site}.fn`);\n lines.push(`${indent} if (${d}.is(${self})) {`);\n inner = `${indent} `;\n invoked = `${site}_f(${values.join(\", \")})`;\n }\n const lifted = args.filter((_a, i) => liftsAt(f.lift, i)).map((a) => `typeof ${a} === \"number\"`);\n if (lifted.length > 0) lines.push(`${inner}if (${lifted.join(\" || \")}) { ${out} = ${generic(x, site, values)}; break ${label}; }`);\n const kinds = args.flatMap((a, i) => kindCheck(f.params?.[i], a, d));\n if (kinds.length > 0) lines.push(`${inner}if (!(${kinds.join(\" && \")})) { ${out} = ${generic(x, site, values)}; break ${label}; }`);\n attempt(invoked, inner);\n resultChecks(out, facts.checks, inner);\n lines.push(`${inner}break ${label};`);\n if (f.method) lines.push(`${indent} }`);\n lines.push(`${indent} }`, `${indent} ${out} = ${generic(x, site, values)};`, `${indent}}`);\n };\n // The statement of a failure (docs/COMPILER.md §4.1). A failure that keeps its error always has one (`keeps`).\n const action = (f: Fail, error: LExpr | undefined): string => {\n switch (f.t) {\n case \"return\":\n return `return ${expr(call(\"raise\", error as LExpr))};`;\n case \"stop\":\n return \"return F;\";\n case \"break\":\n return f.keep === undefined ? `break L${f.label};` : `{ ${name(f.keep)} = ${expr(error as LExpr)}; break L${f.label}; }`;\n case \"continue\":\n return f.strict === undefined ? `continue L${f.label};` : `{ if (${expr(f.strict.cond)}) ${action(f.strict.else, error)} continue L${f.label}; }`;\n }\n };\n const lines: string[] = [];\n const stmts = (ss: readonly LStmt[], indent: string): void => {\n for (const s of ss) stmt(s, indent);\n };\n const stmt = (s: LStmt, indent: string): void => {\n switch (s.t) {\n case \"let\":\n case \"set\":\n if (s.value.t === \"op\" && siteBlock(s.n, s.value, indent)) return;\n lines.push(`${indent}${name(s.n)} = ${expr(s.value)};`);\n return;\n case \"check\":\n lines.push(`${indent}if (!(${expr(s.ok)})) ${action(s.fail, s.error)} // ${s.reason}`);\n return;\n case \"fail\":\n lines.push(`${indent}${action(s.fail, s.error)}`);\n return;\n case \"if\":\n lines.push(`${indent}if (${expr(s.cond)}) {`);\n stmts(s.yes, deeper(indent));\n if (s.no.length > 0) {\n lines.push(`${indent}} else {`);\n stmts(s.no, deeper(indent));\n }\n lines.push(`${indent}}`);\n return;\n case \"loop\": {\n const [a, i] = [name(s.array), name(s.index)];\n lines.push(`${indent}${a} = ${expr(s.over)};`);\n lines.push(`${indent}L${s.label}: for (${i} = 0; ${i} < ${a}.length; ${i}++) {`);\n lines.push(`${indent} ${name(s.item)} = ${a}[${i}];`);\n stmts(s.body, deeper(indent));\n lines.push(`${indent}}`);\n return;\n }\n case \"block\":\n lines.push(`${indent}L${s.label}: {`);\n stmts(s.body, deeper(indent));\n lines.push(`${indent}}`);\n return;\n case \"repeat\":\n lines.push(`${indent}L${s.label}: for (;;) {`);\n stmts(s.body, deeper(indent));\n lines.push(`${indent}}`);\n return;\n case \"break\":\n lines.push(`${indent}break L${s.label};`);\n return;\n case \"next\":\n lines.push(`${indent}continue;`);\n return;\n case \"push\":\n lines.push(`${indent}${name(s.n)}.push(${expr(s.value)});`);\n return;\n case \"return\":\n lines.push(`${indent}return ${expr(s.value)};`);\n return;\n }\n };\n stmts(p.body, \" \");\n const params = Array.from({ length: FIXED_LOCALS }, (_, n) => name(n));\n const locals = Array.from({ length: p.locals - FIXED_LOCALS }, (_, n) => name(n + FIXED_LOCALS));\n const head = [\n `\"use strict\";`,\n `const F = R.F;`,\n // The order is the order of the first use, so the same program gives the same source.\n ...[...used].map((fn) => `const ${fn}_ = R.${fn};`),\n ...[...constants].map((i) => `const k${i} = K[${i}];`),\n ...[...sites].map(([site, init]) => `const ${site} = ${init};`),\n ...[...domains].map((i) => `const d${i} = R.domain(${i});`),\n ...[...fns].map(([f, init]) => `const ${f} = ${init};`),\n ...(threw ? [`const threw_ = R.threw;`] : []),\n `return function vex(${params.join(\", \")}) {`,\n ...(locals.length > 0 ? [` let ${locals.join(\", \")};`] : []),\n ` try {`,\n ];\n const tail = [` } catch {`, ` return F;`, ` }`, `};`, ``];\n const text = [...head, ...lines, ...tail];\n return (indented ? text : text.map((line) => line.trimStart())).join(\"\\n\");\n}\n","/**\n * The lowering: a Vex expression becomes a program of the loop IR (docs/COMPILER.md §3.3). A list op over a direct\n * `each` becomes one loop with a running value, so it makes no list.\n *\n * Each value that the interpreter can give as an error has a check. The block of the check tells what a failure does\n * (`Fail`). A list op skips an error item, and an error in the first argument of `ifError` gives the second argument.\n * These contexts drop the error, so the check has no error site. In each other context, the check has the site of its\n * error, and the program ends with that error or a binding keeps it (`keeps`). Where the error has a use, a check without\n * a site stops the program with `FALLBACK`. `#DEPTH!` of an extension stops the program too (COMPILE.EXT).\n *\n * A check for a result that only tier 1 can give is no error, so no context drops it (`#decide`, V-071).\n *\n * After a failure, the interpreter still evaluates the later arguments of a node, and two errors give `#ARGS`. The value\n * path of generated code has no flags for this. A failure jumps to a copy of the later arguments (`#chain`), which only\n * the failure path reads. A copy uses flags, so the size of the code stays near the size of the program times its depth.\n */\nimport {\n addrExprs,\n axisExprs,\n children,\n errorText,\n isFieldName,\n joinKind,\n limitAxis,\n listOf,\n MAX_ITERATIONS,\n nestingError,\n shapeError,\n type Addr,\n type Axis,\n type ErrorText,\n type Expr,\n type ExprOf,\n type FixJoin,\n type Names,\n type PrimitiveKind,\n} from \"@mark1russell7/vex\";\nimport { factsOf, isFusedOp, MAX_CALLS, primitiveOf, type Facts, type FusedOp, type Schema } from \"./facts.ts\";\nimport { memoNodes } from \"./memo.ts\";\nimport {\n array,\n bool,\n call,\n constant,\n FALLBACK_EXPR,\n FIXED_LOCALS,\n keeps,\n local,\n num,\n ORIGIN,\n plainOf,\n prim,\n RETURN,\n SPACE,\n STOP,\n TABLES,\n VARS,\n type ErrorSite,\n type Fail,\n type LExpr,\n type LoopProgram,\n type LStmt,\n} from \"./loop.ts\";\nimport { placesRead, unshared } from \"./unshared.ts\";\n\n/** The error of an expression that the compiler cannot lower. Then the program operates in tier 1. */\nexport class Unsupported extends Error {}\n\n/**\n * A bound name: its value, and the flag that tells if its binding gave a value. Without a flag, it always does. After a\n * failure, `error` is the lazy error of the binding, if the context of the binding keeps it.\n */\ninterface Bound {\n readonly value: LExpr;\n readonly ok?: LExpr;\n readonly error?: LExpr;\n}\n\n/** A bound function: its node, the path of its node, and the scope of its binding. */\ninterface BoundFn {\n readonly fn: ExprOf<\"fn\">;\n readonly path: readonly number[];\n readonly scope: Scope;\n}\n\n/** The facts of the lexical position of a node: its space, its origin, its focus and its bound names. */\ninterface Scope {\n readonly space: LExpr;\n readonly origin: LExpr;\n readonly focus: LExpr;\n readonly env: ReadonlyMap<string, Bound>;\n /** The bound functions (FN.BIND): a call puts the body of its function at the place of the call. */\n readonly fns: ReadonlyMap<string, BoundFn>;\n /** The record at the focus. In a loop, it reads the record by its index (SPACE.RECORDS). */\n readonly rec: LExpr;\n /** The columns of the steps around the node (COMPILE.FIX): the last round of each name, and its join. */\n readonly columns: ReadonlyMap<string, FixColumn>;\n /** The index of the focus in the keys of the space, if the lowering knows it. A read of a column uses it. */\n readonly slot: LExpr | undefined;\n}\n\n/** A column in the step of its `fix`: the local of an array with the value of each row, and the join of the column. */\ninterface FixColumn {\n readonly local: LExpr;\n readonly join: FixJoin;\n}\n\n/** A list of statements, and what a failed check in it does. */\ninterface Block {\n readonly stmts: LStmt[];\n readonly fail: Fail;\n}\n\nconst block = (fail: Fail): Block => ({ stmts: [], fail });\n\n/**\n * A region of the chains of arguments (`#chain`). The value path of each chain of the region is in one block, `value`.\n * A failure of a part ends that block, and the failure paths of the chains come after it, in `paths`. `fails` holds\n * the failures of the parts. A chain whose block has one of these failures is in the region, so its depth adds nothing.\n */\ninterface Region {\n readonly value: number;\n readonly fails: Set<Fail>;\n readonly paths: LStmt[];\n}\n\n/**\n * The number of nodes that the failure paths of a program can copy. Past it, a node with two or more arguments that can\n * fail keeps no error, so tier 1 gives its result. Thus the size of the code has a limit.\n */\nexport const MAX_COPIED = 2000;\n\n/**\n * The number of arguments of a node that `#chain` takes. The test of the failure path has a term for each argument that\n * can fail, and the printer recurses over these terms. A node with more arguments keeps no error.\n */\nexport const MAX_CHAINED = 64;\n\n/** This function gives the axis inside the `where` axes of an axis. */\nconst baseAxis = (a: Axis): Exclude<Axis, { readonly t: \"where\" }> => (a.t === \"where\" ? baseAxis(a.axis) : a);\n\n/** This function gives the tests of the `where` axes of an axis, from the inside out, as the interpreter applies them. */\nfunction whereTests(a: Axis): readonly Expr[] {\n const out: Expr[] = [];\n for (let x: Axis = a; x.t === \"where\"; x = x.axis) out.unshift(x.test);\n return out;\n}\n\n/** This function gives the number of children of an axis: its list, then the tests of `where`. */\nconst axisChildren = (a: Axis): number => whereTests(a).length + (listOf(a) === undefined ? 0 : 1);\n\n/** This function gives the `each` under the `let` expressions of a list argument, or `undefined`. */\nfunction eachUnderLets(e: Expr | undefined): ExprOf<\"each\"> | undefined {\n let x = e;\n while (x?.tag === \"let\") x = x.body;\n return x?.tag === \"each\" ? x : undefined;\n}\n\n/** The targets of a round of a column: each key of the space, with no address. */\nconst ROWS: Pick<ExprOf<\"each\">, \"axis\"> = { axis: { t: \"all\" } };\n\n/** The primitive operation of each join (FIX.JOIN). The checks of a row give each join a value of its kind. */\nconst JOINS = { or: \"||\", and: \"&&\", max: \"max\", min: \"min\" } as const;\n\n/** The kinds of the values of the primitive operations that always give a boolean. */\nconst BOOLEAN_PRIMS: ReadonlySet<string> = new Set([\"!\", \"===\", \"!==\", \"isNumber\", \"isBoolean\", \"isString\", \"isValue\", \"isObject\"]);\n\n/** The checks of the kinds of a schema. */\nconst KIND_CHECKS = { number: \"isNumber\", string: \"isString\", boolean: \"isBoolean\" } as const;\n\n/** This function gives the kind of two values in the branches of a form, if they have the same kind. */\nconst join = (a: PrimitiveKind | undefined, b: PrimitiveKind | undefined): PrimitiveKind | undefined => (a === b ? a : undefined);\n\n/**\n * This function lowers an expression into a program of the loop IR. It throws `Unsupported` for an expression it cannot\n * lower. The facts of the options decide the op of a site whose values have known kinds (KIND.STATIC).\n */\nexport function lower(expr: Expr, facts: Facts = factsOf({}), schema: Schema = {}): LoopProgram {\n // COMPILE.PLACES: the walks below take the time of the places, so the count comes first.\n const places = placesRead([expr]);\n if (places.error !== undefined) throw new Unsupported(places.error);\n // EVAL.SHAPE and EVAL.NESTING: tier 1 gives the error of a program that is not valid or that is nested too deep.\n const shape = shapeError(expr);\n if (shape !== undefined) throw new Unsupported(shape);\n const deep = nestingError(expr);\n if (deep !== undefined) throw new Unsupported(deep);\n const plain = unshared(expr, places.shares);\n const l = new Lowerer(memoNodes(plain, isFusedOp), facts, schema);\n const b = block(RETURN);\n const top: Scope = { space: local(SPACE), origin: local(ORIGIN), focus: local(ORIGIN), env: new Map(), fns: new Map(), rec: prim(\"get\", local(SPACE), local(ORIGIN)), columns: new Map(), slot: undefined };\n l.check(b, call(\"has\", local(SPACE), local(ORIGIN)), \"the origin is a key of the space\", l.site(b, top, { t: \"key\" }));\n const value = l.expr(plain, top, [], b);\n b.stmts.push({ t: \"return\", value });\n return { body: flat(b.stmts), locals: l.locals, constants: l.constants };\n}\n\n/** This function gives the statements that a statement holds, in the order of the source. */\nfunction bodiesOf(x: LStmt): readonly (readonly LStmt[])[] {\n if (x.t === \"if\") return [x.yes, x.no];\n return x.t === \"loop\" || x.t === \"block\" || x.t === \"repeat\" ? [x.body] : [];\n}\n\n/** This function gives the label that a failure ends or continues, or the labels of a strict failure. */\nfunction failLabels(f: Fail): readonly number[] {\n if (f.t === \"break\") return [f.label];\n if (f.t === \"continue\") return f.strict === undefined ? [f.label] : [f.label, ...failLabels(f.strict.else)];\n return [];\n}\n\n/**\n * This function moves the first statements of a block out of the block, while they do not end it (V-089). Such a\n * statement runs first in both places, and its jumps go to the same statements. A block with no jump to it goes away.\n * Thus a node in the first part of a node adds no level of blocks.\n *\n * The first walk gives each statement a number in the order of the source, and the first jump to each label. The\n * second walk counts in the same order. A statement holds a jump to the block only if that jump has a number in the\n * range of the statement. Thus each walk reads each statement once.\n */\nfunction flat(body: readonly LStmt[]): LStmt[] {\n const first = new Map<number, number>();\n // The number of the last statement inside each statement, at the index of the number of the statement.\n const ends: number[] = [0];\n let at = 0;\n const note = (xs: readonly LStmt[]): void => {\n for (const x of xs) {\n const self = ++at;\n const labels = x.t === \"break\" ? [x.label] : x.t === \"check\" || x.t === \"fail\" ? failLabels(x.fail) : [];\n for (const label of labels) if (!first.has(label)) first.set(label, self);\n bodiesOf(x).forEach(note);\n ends[self] = at;\n }\n };\n note(body);\n at = 0;\n // Each statement goes into its list once: a moved statement goes straight into the list of the block around it.\n const walk = (xs: readonly LStmt[], out: LStmt[] = []): LStmt[] => {\n for (const x of xs) one(x, out);\n return out;\n };\n const one = (x: LStmt, out: LStmt[]): void => {\n at++;\n if (x.t === \"if\") out.push({ ...x, yes: walk(x.yes), no: walk(x.no) });\n else if (x.t === \"loop\" || x.t === \"repeat\") out.push({ ...x, body: walk(x.body) });\n else if (x.t !== \"block\") out.push(x);\n else {\n const jump = first.get(x.label) ?? Number.POSITIVE_INFINITY;\n let rest: LStmt[] | undefined;\n for (const y of x.body) {\n if (rest === undefined && jump <= (ends[at + 1] ?? 0)) rest = [];\n one(y, rest ?? out);\n }\n if (rest !== undefined) out.push({ ...x, body: rest });\n }\n };\n return walk(body);\n}\n\nclass Lowerer {\n locals = FIXED_LOCALS;\n labels = 0;\n memos = 0;\n /** The number of bodies of functions that the lowering put at calls (MAX_CALLS). A copy does not count. */\n #calls = 0;\n /** The depth of the copies of the failure paths around the lowering. Inside a copy, a node has no memo. */\n #copying = 0;\n /** The number of nodes that the copies have so far (MAX_COPIED). */\n #copied = 0;\n /** The answers of `#mayExt`, for each map of functions. */\n readonly #exts = new WeakMap<ReadonlyMap<string, BoundFn>, Map<Expr, boolean>>();\n readonly #memo: ReadonlyMap<Expr, readonly Expr[]>;\n /** The keys of the nodes of the memo whose code the lowering makes, with their values. */\n #keys: ReadonlyMap<Expr, Bound> = new Map();\n /** The region of the chain whose parts the lowering makes at this time (`#chain`). */\n #region: Region | undefined = undefined;\n /** The depth of the loops around the lowering. */\n #loops = 0;\n /** The depth of the loops at the start of the code of a node of the memo with no keys, or `undefined` outside such code. */\n #once: number | undefined = undefined;\n readonly #facts: Facts;\n readonly #schema: Schema;\n /** The kind of each local whose kind the lowering knows. A local gets its kind where it gets its value. */\n readonly #kinds = new Map<number, PrimitiveKind>();\n\n constructor(memo: ReadonlyMap<Expr, readonly Expr[]>, facts: Facts, schema: Schema) {\n this.#memo = memo;\n this.#facts = facts;\n this.#schema = schema;\n }\n\n /** This method gives the kind of a value, if the lowering knows it. */\n kindOf(x: LExpr): PrimitiveKind | undefined {\n if (x.t === \"const\") {\n const t = typeof this.constants[x.i];\n return t === \"number\" || t === \"string\" || t === \"boolean\" ? t : undefined;\n }\n if (x.t === \"local\") return this.#kinds.get(x.n);\n // The other values have no kind that the lowering knows.\n return x.t === \"prim\" && BOOLEAN_PRIMS.has(x.op) ? \"boolean\" : undefined;\n }\n\n /** This method gives a local the kind `kind`. A value that is not a local keeps its kind. */\n #typed(x: LExpr, kind: PrimitiveKind | undefined): LExpr {\n if (x.t === \"local\" && kind !== undefined) this.#kinds.set(x.n, kind);\n return x;\n }\n\n /**\n * This method checks the kind that the schema declares for a value. A failure is no error of the interpreter, so it\n * stops the program, and tier 1 evaluates it.\n */\n #declared(b: Block, x: LExpr, kind: PrimitiveKind | undefined, reason: string): LExpr {\n if (kind === undefined) return x;\n this.#decide(b, prim(KIND_CHECKS[kind], x), reason);\n return this.#typed(x, kind);\n }\n\n /**\n * This method adds a check whose failure is no error of the program. Tier 1 decides the result, so the check stops the\n * program in each block. `check` is for an error, and a context that catches an error drops its failure (V-071).\n */\n #decide(b: Block, ok: LExpr, reason: string): void {\n b.stmts.push({ t: \"check\", ok, reason, fail: STOP });\n }\n\n readonly constants: unknown[] = [];\n readonly #pool = new Map<unknown, number>();\n\n /** This method gives the index of the constant of a value. The same value has one constant. A map key does not tell 0 from -0, so -0 has its own. */\n index(value: unknown): number {\n // Stryker disable next-line UnaryOperator: with +0 as the special key, 0 and -0 still get different constants\n const k = Object.is(value, -0) ? NEGATIVE_ZERO : value;\n let i = this.#pool.get(k);\n if (i === undefined) {\n i = this.constants.push(value) - 1;\n this.#pool.set(k, i);\n }\n return i;\n }\n\n /** This method gives the constant of a value. */\n constant(value: unknown): LExpr {\n return constant(this.index(value));\n }\n\n /** This method gives the number of a new local of a kind. */\n typedLocal(kind: PrimitiveKind): number {\n const n = this.locals++;\n this.#kinds.set(n, kind);\n return n;\n }\n\n /** This method gives a new local with a value. */\n value(b: Block, value: LExpr): LExpr {\n const n = this.locals++;\n b.stmts.push({ t: \"let\", n, value });\n return local(n);\n }\n\n /**\n * This method gives the lazy error of a site, where the block keeps it. `undefined` tells that the block drops the\n * error, so the site is not a constant of the program.\n */\n site(b: Block, s: Pick<Scope, \"origin\" | \"focus\">, site: ErrorSite, ...operands: LExpr[]): LExpr | undefined {\n return keeps(b.fail) ? call(\"err\", { t: \"site\", i: this.constants.push(site) - 1 }, s.origin, s.focus, ...operands) : undefined;\n }\n\n /** This method gives the lazy error of a text. */\n #text(b: Block, s: Scope, path: readonly number[], text: ErrorText): LExpr | undefined {\n return this.site(b, s, { t: \"text\", text, path });\n }\n\n /** This method adds a check. Without a lazy error, the failure is the plain failure of the block. */\n check(b: Block, ok: LExpr, reason: string, error?: LExpr): void {\n b.stmts.push(error === undefined ? { t: \"check\", ok, reason, fail: plainOf(b.fail) } : { t: \"check\", ok, reason, fail: b.fail, error });\n }\n\n /** This method gives a new local with the value of a call of the runtime, and a check that the value is not `FALLBACK`. */\n checked(b: Block, value: LExpr, reason: string, error?: LExpr): LExpr {\n const x = this.value(b, value);\n this.check(b, prim(\"!==\", x, FALLBACK_EXPR), reason, error);\n return x;\n }\n\n /** This method adds a failure: the interpreter always gives an error here. */\n fail(b: Block, error?: LExpr): LExpr {\n b.stmts.push(error === undefined ? { t: \"fail\", fail: plainOf(b.fail) } : { t: \"fail\", fail: b.fail, error });\n return FALLBACK_EXPR;\n }\n\n expr(e: Expr, s: Scope, path: readonly number[], b: Block): LExpr {\n // Inside a node of the memo, the value of a key replaces the key. An error of the key is an error at each place.\n const key = this.#keys.get(e);\n if (key !== undefined) {\n if (key.ok !== undefined) this.check(b, key.ok, \"a key with a value\");\n return key.value;\n }\n // In the code of a node of the memo with no keys, outside a loop of that code, a node evaluates at most once for each space. Its memo thus saves nothing (V-089).\n const keys = this.#copying > 0 || this.#once === this.#loops ? undefined : this.#memo.get(e);\n return keys === undefined ? this.#node(e, s, path, b) : this.#memoized(e, keys, s, path, b);\n }\n\n /** This method lowers a copy of a part of a failure path. */\n #copy(make: () => void): void {\n this.#copying++;\n make();\n this.#copying--;\n }\n\n /** This method lowers a loop of names. A node of the memo inside the loop keeps its memo. */\n #inLoop(make: () => LExpr): LExpr {\n this.#loops++;\n const value = make();\n this.#loops--;\n return value;\n }\n\n /** This method lowers a node itself, without the memo. */\n #node(e: Expr, s: Scope, path: readonly number[], b: Block): LExpr {\n if (this.#copying > 0) this.#copied++;\n switch (e.tag) {\n case \"lit\":\n return this.constant(e.value);\n case \"ref\":\n return this.#ref(e, s, path, b);\n case \"var\": {\n const bound = s.env.get(e.name);\n // A function is not a value (FN.VALUE): tier 1 gives the error. A name of a loop hides a function with its name.\n if (bound === undefined && s.fns.has(e.name)) return this.fail(b, this.#text(b, s, path, errorText.functionValue(e.name)));\n if (bound === undefined) {\n const x = this.checked(b, call(\"var\", local(VARS), this.constant(e.name)), \"a variable\", this.#text(b, s, path, errorText.unbound(e.name)));\n return this.#declared(b, x, primitiveOf(this.#schema.vars?.[e.name]), \"a variable of the schema\");\n }\n this.#read(b, bound, \"a binding with a value\");\n return bound.value;\n }\n case \"let\":\n return this.expr(e.body, { ...s, ...this.#bind(e, s, path, b) }, [...path, Object.keys(e.bind).length], b);\n // A function is only a binding of let, so the check of the shape stops this node first.\n // Stryker disable next-line all: see the comment above\n /* v8 ignore next -- @preserve */\n case \"fn\": return this.fail(b);\n case \"call\":\n return this.#call(e, s, path, b);\n case \"rec\": {\n const values = this.#all(Object.values(e.fields), s, path, 0, \"fields\", b);\n return this.value(b, call(\"rec\", this.constant(Object.keys(e.fields)), array(...values)));\n }\n case \"app\":\n return this.#app(e, s, path, b);\n case \"fold\":\n return this.#inLoop(() => this.#fold(e, s, path, b));\n case \"iterate\":\n return this.#inLoop(() => this.#iterate(e, s, path, b));\n case \"fix\":\n return this.#inLoop(() => this.#fix(e, s, path, b));\n case \"last\": {\n const column = s.columns.get(e.name);\n // The lowering comes before the checks. A read outside a step fails a check, and that check gives the reason.\n return column === undefined ? this.fail(b) : this.#rowOf(e.name, column, s, path, b);\n }\n case \"each\": {\n // A list keeps its error items, and generated code makes no error items. Thus an error item stops the program, and\n // tier 1 gives the list.\n const keys = this.locals++;\n const values = this.locals++;\n b.stmts.push({ t: \"let\", n: keys, value: array() }, { t: \"let\", n: values, value: array() });\n this.#loop(e, s, path, b, () => STOP, (body, key, v) => {\n body.stmts.push({ t: \"push\", n: keys, value: key }, { t: \"push\", n: values, value: v });\n });\n return this.value(b, call(\"list\", local(keys), local(values)));\n }\n case \"ext\": {\n // COMPILE.EXT: an error of an extension is an error of the block. The runtime throws for #DEPTH!, which stops the program.\n return this.checked(b, call(\"ext\", this.constant(e.kind), this.constant(e.data), s.space, s.origin, s.focus, this.constant(path)), \"an extension\", this.site(b, s, { t: \"ext\", kind: e.kind, path }));\n }\n }\n }\n\n /**\n * This method gives the value of a node that depends only on the space (§7.2). The memo has an entry for each space.\n * Without the entry of the space, the node evaluates in a block, and an error of it makes an entry without a value.\n * An exception stops the program, so the memo gets no entry for it.\n *\n * The entry has no error, because the error of a node depends on its position and on its child nodes. Where the context\n * keeps the error, a copy of the node evaluates after a read of such an entry. The copy gives the error at this position.\n * A node of the memo and its keys use no extension, so this second evaluation has no effect.\n *\n * The code of a node with no keys evaluates once for each space. Outside its loops, a node inside it thus evaluates\n * once too, and it gets no memo of its own (`#once`). So the code of nested nodes has no nested blocks (V-089).\n */\n #memoized(e: Expr, keys: readonly Expr[], s: Scope, path: readonly number[], b: Block): LExpr {\n const memo: LExpr = { t: \"memo\", id: this.memos++ };\n // Each key evaluates here, in a block of its own, as a binding does.\n const values = keys.map((k): Bound => this.#attempt(b, (inner) => this.expr(k, s, path, inner), false));\n const tuple = array(...values.flatMap((k) => [k.value, flag(k)]));\n const h = this.locals++;\n const outer = this.#keys;\n this.#keys = new Map([...outer, ...keys.map((k, i): [Expr, Bound] => [k, values[i] as Bound])]);\n const compute = block(b.fail);\n const once = this.#once;\n this.#once = keys.length === 0 ? this.#loops : undefined;\n const node = this.#attempt(compute, (inner) => this.#node(e, s, path, inner), false);\n this.#once = once;\n this.#keys = outer;\n compute.stmts.push({ t: \"set\", n: h, value: prim(\"memoPut\", memo, s.space, tuple, node.value, flag(node)) });\n b.stmts.push({ t: \"let\", n: h, value: prim(\"memoGet\", memo, s.space, tuple) }, { t: \"if\", cond: prim(\"!\", prim(\"isValue\", local(h))), yes: compute.stmts, no: [] });\n const entry = prim(\"entryOk\", local(h));\n const stop: LStmt = { t: \"check\", ok: entry, reason: \"a value of the memo\", fail: plainOf(b.fail) };\n if (keeps(b.fail) && this.#copied < MAX_COPIED) {\n const copy = block(b.fail);\n this.#copy(() => this.#node(e, s, path, copy));\n b.stmts.push({ t: \"if\", cond: prim(\"!\", entry), yes: [...copy.stmts, stop], no: [] });\n } else {\n b.stmts.push(stop);\n }\n // Each entry of the memo comes from the code of the node, so it has the kind of the value of the node.\n return this.#typed(this.value(b, prim(\"entryValue\", local(h))), this.kindOf(node.value));\n }\n\n /**\n * This method lowers the arguments of an op or the fields of a record, with the child indexes from `first`. After an\n * error, the interpreter still evaluates the later arguments, and two errors give `#ARGS` (`#all` of the interpreter).\n * Where the context keeps the error of two or more arguments that can fail, `#chain` or `#collect` lowers them.\n *\n * An extension in a later argument can give `#DEPTH!`. Thus, where the program catches the error, each argument before\n * the last one that can use an extension has its own block (COMPILE.EXT). Then a failure skips no extension.\n */\n #all(xs: readonly Expr[], s: Scope, path: readonly number[], first: number, what: string, b: Block): LExpr[] {\n if (keeps(b.fail) && xs.filter((x) => x.tag !== \"lit\").length > 1) {\n if (this.#copying > 0) return this.#collect(xs, s, path, first, what, b);\n if (this.#copied < MAX_COPIED && xs.length <= MAX_CHAINED) return this.#chain(xs, s, path, first, what, b);\n return this.#all(xs, s, path, first, what, { stmts: b.stmts, fail: plainOf(b.fail) });\n }\n const last = b.fail.t === \"return\" || b.fail.t === \"stop\" ? -1 : xs.findLastIndex((x) => this.#mayExt(x, s.fns));\n const parts = xs.map((x, i): Bound => {\n const at = [...path, first + i];\n return i < last ? this.#attempt(b, (inner) => this.expr(x, s, at, inner)) : { value: this.expr(x, s, at, b) };\n });\n for (const x of parts) if (x.ok !== undefined) this.check(b, x.ok, \"an argument with a value\");\n return parts.map((x) => x.value);\n }\n\n /**\n * This method lowers arguments on the value path, with no new check. A failure of an argument keeps its error in a\n * local of the argument. It then ends the value block of the region, and the failure path of the chain copies the\n * later arguments that can fail. After the last copy, the errors give the error of the node (`args` of the runtime).\n * The failure path clears the locals, for the next turn of a loop.\n *\n * Each argument evaluates once: the value path gives up at the failure, and the copies start after it.\n *\n * The value path of a chain has no block of its own (V-089). A chain in a part of another chain is in the region of\n * that chain. So its parts go into the value block of the region, and its failure path goes before the failure path of\n * the outer chain. The depth of the blocks thus stays the same for each level of a shape. Before, each level added\n * 3 blocks around argument 0, and the time of the parse of `new Function` grew with the lines times that depth.\n */\n #chain(xs: readonly Expr[], s: Scope, path: readonly number[], first: number, what: string, b: Block): LExpr[] {\n const joined = this.#region?.fails.has(b.fail) === true ? this.#region : undefined;\n const region: Region = joined ?? { value: this.labels++, fails: new Set(), paths: [] };\n const outer = this.#region;\n this.#region = region;\n // The parts write into one list: the statements of the block of a joined chain, or the value block of the region.\n // So a statement goes into a list once, and the lowering stays linear in the depth of the chains.\n const sink = joined === undefined ? [] : b.stmts;\n const parts = xs.map((x, i) => {\n const error = this.locals++;\n const fail: Fail = { t: \"break\", label: region.value, keep: error };\n region.fails.add(fail);\n const at = [...path, first + i];\n const start = sink.length;\n const value = this.expr(x, s, at, { stmts: sink, fail });\n return { x, at, error, value, fails: sink.length > start };\n });\n this.#region = outer;\n const values = parts.map((p) => p.value);\n const failing = parts.filter((p) => p.fails);\n if (failing.length === 0) return values;\n // Only the failed part has an error at the start of the failure path. A part after a part with an error has a copy.\n const failed = (p: (typeof failing)[number]): LExpr => prim(\"isValue\", local(p.error));\n const after = this.locals++;\n const copies: LStmt[] = [];\n failing.forEach((p, i) => {\n const next = failing[i + 1];\n if (next === undefined) return;\n copies.push({ t: \"set\", n: after, value: i === 0 ? failed(p) : prim(\"||\", local(after), failed(p)) });\n const label = this.labels++;\n const copy = block({ t: \"break\", label, keep: next.error });\n this.#copy(() => this.expr(next.x, s, next.at, copy));\n copies.push({ t: \"if\", cond: local(after), yes: [{ t: \"block\", label, body: copy.stmts }], no: [] });\n });\n const inner = block(b.fail);\n const error = this.value(inner, this.#argsError(s, path, what, failing.map((p) => local(p.error))));\n inner.stmts.push(...failing.map((p): LStmt => ({ t: \"set\", n: p.error, value: { t: \"none\" } })));\n // In the region of an outer chain, the failure path keeps the error for the part of the outer chain. The failure path of that chain comes next.\n if (joined !== undefined && b.fail.t === \"break\" && b.fail.keep !== undefined) inner.stmts.push({ t: \"set\", n: b.fail.keep, value: error });\n else this.fail(inner, error);\n const chainFailed = failing.slice(1).reduce((x, p) => prim(\"||\", x, failed(p)), failed(failing[0] as (typeof failing)[number]));\n region.paths.push({ t: \"if\", cond: chainFailed, yes: [...copies, ...inner.stmts], no: [] });\n if (joined !== undefined) return values;\n const end = this.labels++;\n sink.push({ t: \"break\", label: end });\n b.stmts.push({ t: \"block\", label: end, body: [{ t: \"block\", label: region.value, body: sink }, ...region.paths] });\n return values;\n }\n\n /**\n * This method lowers arguments in a copy. The value path does not read a copy, so each argument can have its own block\n * and its flag. A node in a copy thus adds no other copy, and the size of the code stays near the size of the node.\n */\n #collect(xs: readonly Expr[], s: Scope, path: readonly number[], first: number, what: string, b: Block): LExpr[] {\n const parts = xs.map((x, i): Bound => this.#attempt(b, (inner) => this.expr(x, s, [...path, first + i], inner)));\n const errors = parts.flatMap((p) => (p.ok === undefined ? [] : [prim(\"unless\", p.ok, p.value)]));\n if (errors.length > 0) {\n const error = this.value(b, this.#argsError(s, path, what, errors));\n this.check(b, prim(\"!\", prim(\"isValue\", error)), \"the arguments have values\", error);\n }\n return parts.map((p) => p.value);\n }\n\n /** This method gives the call of the runtime that makes the error of some arguments. */\n #argsError(s: Scope, path: readonly number[], what: string, errors: readonly LExpr[]): LExpr {\n const site = this.constants.push({ t: \"args\", what, path } satisfies ErrorSite) - 1;\n return call(\"args\", { t: \"site\", i: site }, s.origin, s.focus, array(...errors));\n }\n\n /**\n * This method tells if an expression can call an extension. A call reads the body of its function, and the bodies of\n * the functions of that body. A function cannot call itself, so the search ends. Each node has one answer for each\n * map of functions, because functions can call each other many times (V-068).\n */\n #mayExt(e: Expr, fns: ReadonlyMap<string, BoundFn>): boolean {\n let answers = this.#exts.get(fns);\n if (answers === undefined) {\n answers = new Map();\n this.#exts.set(fns, answers);\n }\n const known = answers.get(e);\n if (known !== undefined) return known;\n const bound = e.tag === \"call\" ? fns.get(e.fn) : undefined;\n const answer = e.tag === \"ext\" || (bound !== undefined && this.#mayExt(bound.fn.body, bound.scope.fns)) || children(e).some((x) => this.#mayExt(x, fns));\n answers.set(e, answer);\n return answer;\n }\n\n /**\n * This method evaluates an expression in a block whose errors end the block, as a binding does. It gives the value\n * and the flag that tells if the value exists. Without statements, the expression always has a value, so it gets no\n * flag. With `keep`, a failure keeps its lazy error in the local of the value: only the failure path writes it there.\n */\n #attempt(b: Block, make: (inner: Block) => LExpr, keep = keeps(b.fail)): Bound {\n const label = this.labels++;\n const v = this.locals++;\n const attempt = block(keep ? { t: \"break\", label, keep: v } : { t: \"break\", label });\n const value = make(attempt);\n if (attempt.stmts.length === 0) return { value };\n const ok = this.locals++;\n this.#typed(local(v), this.kindOf(value));\n attempt.stmts.push({ t: \"set\", n: v, value }, { t: \"set\", n: ok, value: bool(true) });\n b.stmts.push({ t: \"let\", n: ok, value: bool(false) }, { t: \"block\", label, body: attempt.stmts });\n return keep ? { value: local(v), ok: local(ok), error: local(v) } : { value: local(v), ok: local(ok) };\n }\n\n /** This method adds the check of a read of a bound name. An error of the binding is the error of the read. */\n #read(b: Block, bound: Bound, reason: string): void {\n if (bound.ok !== undefined) this.check(b, bound.ok, reason, bound.error);\n }\n\n /**\n * This method reads a field, as `ref` of the interpreter: the record of the key, and then each segment of the path.\n * A segment that cannot name a field always gives an error.\n */\n #ref(e: ExprOf<\"ref\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const moved = e.at === undefined || e.at.length === 0 ? undefined : this.#address(e.at, s, path, 0, b);\n const key = moved ?? s.focus;\n const missing = (where: string): LExpr | undefined => this.site(b, s, { t: \"missing\", where, path }, key);\n const n = this.locals++;\n const x = local(n);\n b.stmts.push({ t: \"let\", n, value: moved === undefined ? s.rec : prim(\"get\", s.space, moved) });\n this.check(b, prim(\"isValue\", x), \"a record\", missing(e.path.length === 0 ? \"(record)\" : e.path.join(\".\")));\n for (const [i, seg] of e.path.entries()) {\n const where = e.path.slice(0, i + 1).join(\".\");\n if (!isFieldName(seg)) return this.fail(b, missing(where));\n this.check(b, prim(\"isObject\", x), \"an object\", missing(where));\n b.stmts.push({ t: \"set\", n, value: prim(\"member\", x, this.constant(seg)) });\n this.check(b, prim(\"isValue\", x), \"a field\", missing(where));\n }\n const [field, ...more] = e.path;\n // Tier 2 knows only the primitive kinds. A value of a domain goes through the dispatch of the runtime.\n return field === undefined || more.length > 0 ? x : this.#declared(b, x, primitiveOf(this.#schema.fields?.[field]), \"a field of the schema\");\n }\n\n /**\n * This method binds the names of a `let`. The interpreter evaluates each binding in the scope outside the `let`. An\n * error of a binding is an error only where the body reads the name. Thus an error ends the block of the binding, and\n * a flag tells each read of the name that the binding has no value.\n */\n #bind(e: ExprOf<\"let\">, s: Scope, path: readonly number[], b: Block): Pick<Scope, \"env\" | \"fns\"> {\n const env = new Map(s.env);\n // A let with no function keeps the map of functions, so the answers of `#mayExt` for that map stay (V-089).\n const fns = Object.values(e.bind).some((x) => x.tag === \"fn\") ? new Map(s.fns) : undefined;\n Object.entries(e.bind).forEach(([name, x], i) => {\n // A function evaluates at each call. A binding sees the scope of the let, so a function cannot call itself.\n // A value hides a function of its name, because a read looks at the values first.\n if (x.tag === \"fn\") {\n fns?.set(name, { fn: x, path: [...path, i], scope: s });\n env.delete(name);\n } else {\n env.set(name, this.#attempt(b, (inner) => this.expr(x, s, [...path, i], inner)));\n }\n });\n return { env, fns: fns ?? s.fns };\n }\n\n /**\n * This method lowers a call (FN.CALL). The body of the function goes at the place of the call, with the values of the\n * arguments for its parameters. The body sees the names of the place of its binding.\n */\n #call(e: ExprOf<\"call\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const value = s.env.get(e.fn);\n if (value !== undefined) {\n this.#read(b, value, \"a binding with a value\");\n return this.fail(b, this.#text(b, s, path, errorText.notFunction(e.fn)));\n }\n const bound = s.fns.get(e.fn);\n // The name can be a variable of the run: only the run tells the error.\n if (bound === undefined) return this.fail(b, this.site(b, s, { t: \"call\", name: e.fn, path }, local(VARS)));\n if (bound.fn.params.length !== e.args.length) return this.fail(b, this.#text(b, s, path, errorText.arity(e.fn, bound.fn.params.length, e.args.length)));\n if (this.#copying === 0 && ++this.#calls > MAX_CALLS) throw new Unsupported(`the calls put the bodies of functions in more than ${String(MAX_CALLS)} places`);\n const env = new Map(bound.scope.env);\n bound.fn.params.forEach((p, i) => env.set(p, this.#attempt(b, (inner) => this.expr(e.args[i] as Expr, s, [...path, i], inner))));\n return this.expr(bound.fn.body, { ...s, env, fns: bound.scope.fns }, [...bound.path, 0], b);\n }\n\n #app(e: ExprOf<\"app\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const { op, args } = e;\n switch (op) {\n case \"if\":\n return this.#if(args, s, path, b);\n case \"and\":\n case \"or\":\n return args.length === 0 ? this.fail(b, this.#text(b, s, path, errorText.needsArguments(op))) : this.#andOr(op === \"or\", args, 0, s, path, b);\n case \"ifError\":\n return this.#ifError(args, s, path, b);\n }\n if (isFusedOp(op)) {\n const target = eachUnderLets(args[0]);\n if (target !== undefined) return this.#fused(op, e, target, s, path, b);\n }\n const values = this.#all(args, s, path, 0, \"arguments\", b);\n const kinds = values.map((x) => this.kindOf(x));\n // A static site checks the kind of its result, so the result has the kind that the op declares (KIND.RETURNS).\n const site = this.#facts.staticSite(op, kinds);\n const x = this.checked(b, { t: \"op\", name: this.index(op), args: values, kinds }, \"an op\", this.site(b, s, { t: \"op\", op, path }));\n return this.#typed(x, site?.t === \"fn\" ? primitiveOf(site.returns) : undefined);\n }\n\n /** The condition must be a boolean. Only the branch that the condition selects is evaluated. */\n #if(args: readonly Expr[], s: Scope, path: readonly number[], b: Block): LExpr {\n const [cond, yes, no] = args;\n if (cond === undefined) return this.fail(b, this.#text(b, s, path, errorText.needsArgument(\"if\", 0)));\n const c = this.#boolean(this.expr(cond, s, [...path, 0], b), b, s, { t: \"boolean\", op: \"if\", i: 0, path });\n const r = this.locals++;\n const kinds: (PrimitiveKind | undefined)[] = [];\n const branch = (x: Expr | undefined, i: number): LStmt[] => {\n const inner = block(b.fail);\n const value = x === undefined ? this.fail(inner, this.#text(inner, s, path, errorText.needsArgument(\"if\", i))) : this.expr(x, s, [...path, i], inner);\n kinds.push(this.kindOf(value));\n inner.stmts.push({ t: \"set\", n: r, value });\n return inner.stmts;\n };\n b.stmts.push({ t: \"if\", cond: c, yes: branch(yes, 1), no: branch(no, 2) });\n return this.#typed(local(r), join(kinds[0], kinds[1]));\n }\n\n /** `or` stops at the first `true`, and `and` at the first `false`. Each argument before the stop must be a boolean. */\n #andOr(isOr: boolean, args: readonly Expr[], i: number, s: Scope, path: readonly number[], b: Block, r = this.locals++): LExpr {\n const x = this.#boolean(this.expr(args[i] as Expr, s, [...path, i], b), b, s, { t: \"boolean\", op: isOr ? \"or\" : \"and\", i, path });\n this.#typed(local(r), \"boolean\");\n if (i === args.length - 1) {\n b.stmts.push({ t: \"set\", n: r, value: x });\n } else {\n const rest = block(b.fail);\n this.#andOr(isOr, args, i + 1, s, path, rest, r);\n const stop: LStmt[] = [{ t: \"set\", n: r, value: bool(isOr) }];\n b.stmts.push(isOr ? { t: \"if\", cond: x, yes: stop, no: rest.stmts } : { t: \"if\", cond: x, yes: rest.stmts, no: stop });\n }\n return local(r);\n }\n\n /**\n * The value of the first argument, or else the value of the second argument. An error of the first argument ends its\n * block. An exception, for example #DEPTH!, stops the program, so `ifError` does not hide it (EVAL.DEPTH).\n */\n #ifError(args: readonly Expr[], s: Scope, path: readonly number[], b: Block): LExpr {\n const [first, second] = args;\n if (first === undefined) return this.fail(b, this.#text(b, s, path, errorText.needsArgument(\"ifError\", 1)));\n const label = this.labels++;\n const r = this.locals++;\n const ok = this.locals++;\n const attempt = block({ t: \"break\", label });\n const value = this.expr(first, s, [...path, 0], attempt);\n attempt.stmts.push({ t: \"set\", n: r, value }, { t: \"set\", n: ok, value: bool(true) });\n const otherwise = block(b.fail);\n const fallback = second === undefined ? this.fail(otherwise, this.#text(otherwise, s, path, errorText.needsArgument(\"ifError\", 1))) : this.expr(second, s, [...path, 1], otherwise);\n otherwise.stmts.push({ t: \"set\", n: r, value: fallback });\n b.stmts.push({ t: \"let\", n: ok, value: bool(false) }, { t: \"block\", label, body: attempt.stmts }, { t: \"if\", cond: prim(\"!\", local(ok)), yes: otherwise.stmts, no: [] });\n return this.#typed(local(r), join(this.kindOf(value), this.kindOf(fallback)));\n }\n\n /** A value of a known kind needs no check. */\n #boolean(x: LExpr, b: Block, s: Pick<Scope, \"origin\" | \"focus\">, site: ErrorSite): LExpr {\n if (this.kindOf(x) !== \"boolean\") this.check(b, prim(\"isBoolean\", x), \"a boolean\", this.site(b, s, site, x));\n return x;\n }\n\n #number(x: LExpr, b: Block, s: Scope, site: ErrorSite): LExpr {\n if (this.kindOf(x) !== \"number\") this.check(b, prim(\"isNumber\", x), \"a number\", this.site(b, s, site, x));\n return x;\n }\n\n /**\n * This method lowers a list op over an `each` into one loop. Like the interpreter, the loop skips an error item, and\n * with the option `strict` the list op fails at an error item. `errors` gives the error values, so an error item of\n * `errors` stops the program.\n *\n * The loop checks the items in the order of the interpreter, so the first bad item is the item of the interpreter. Two\n * cases differ. With `strict`, the first error item of the whole list comes before a check of the op. With an extension\n * in the list, the interpreter evaluates each item before the op. In both cases, a check of the op keeps no error.\n * The later arguments evaluate before the loop, and the interpreter evaluates them after the list, so they keep no error.\n */\n #fused(op: FusedOp, e: ExprOf<\"app\">, target: ExprOf<\"each\">, s: Scope, path: readonly number[], b: Block): LExpr {\n // The `let` expressions above the `each`, from the outside in.\n let inner = s;\n let at = [...path, 0];\n for (let x = e.args[0] as Expr; x.tag === \"let\"; x = x.body) {\n inner = { ...inner, ...this.#bind(x, inner, at, b) };\n at = [...at, Object.keys(x.bind).length];\n }\n // COMPILE.EXT: the interpreter evaluates each item of the list before the op, and an extension in an item can give\n // #DEPTH!. Thus a failure that would skip the later items stops the program, if the list can call an extension.\n const skip: Block = this.#mayExt(e.args[0] as Expr, s.fns) ? { stmts: b.stmts, fail: STOP } : b;\n const plain: Block = { stmts: b.stmts, fail: plainOf(skip.fail) };\n const rest = this.#all(e.args.slice(1), s, path, 1, \"arguments\", plain);\n const options = op === \"reduce\" ? rest[1] : rest[0];\n const strict = options === undefined ? undefined : this.value(b, prim(\"===\", call(\"opts\", options), bool(true)));\n const name = rest[0];\n if (op === \"reduce\") {\n if (name === undefined) return this.fail(plain);\n this.check(plain, prim(\"isString\", name), \"an op name\");\n }\n const items = (label: number): Fail => {\n if (op === \"errors\") return STOP;\n return strict === undefined ? { t: \"continue\", label } : { t: \"continue\", label, strict: { cond: strict, else: skip.fail } };\n };\n const opFail = strict === undefined ? skip.fail : plain.fail;\n\n const acc = this.locals++;\n const n = this.typedLocal(\"number\");\n const init = (value: LExpr): void => {\n b.stmts.push({ t: \"let\", n: acc, value });\n };\n b.stmts.push({ t: \"let\", n, value: num(0) });\n const count = (body: Block): void => {\n body.stmts.push({ t: \"set\", n, value: prim(\"+\", local(n), num(1)) });\n };\n // A check of the list op itself is in the loop, but its failure is a failure of the list op.\n const opCheck = (body: Block): Block => ({ stmts: body.stmts, fail: opFail });\n const firstThen = (body: Block, v: LExpr, then: (later: Block) => LExpr): void => {\n const later = block(opFail);\n later.stmts.push({ t: \"set\", n: acc, value: then(later) });\n body.stmts.push({ t: \"if\", cond: prim(\"===\", local(n), num(0)), yes: [{ t: \"set\", n: acc, value: v }], no: later.stmts });\n };\n const nonEmpty = (): void => {\n this.check(b, prim(\"!==\", local(n), num(0)), \"a list that is not empty\", this.#text(b, s, path, errorText.empty(op)));\n };\n const opError = (): LExpr | undefined => this.site(b, s, { t: \"op\", op, path });\n const numbers: ErrorSite = { t: \"items\", op, what: \"numbers\", path };\n\n switch (op) {\n case \"count\":\n this.#loop(target, inner, at, b, items, (body) => count(body));\n return local(n);\n case \"sum\":\n case \"mean\":\n init(num(0));\n this.#loop(target, inner, at, b, items, (body, _key, v) => {\n body.stmts.push({ t: \"set\", n: acc, value: prim(\"+\", local(acc), this.#number(v, opCheck(body), s, numbers)) });\n count(body);\n });\n if (op === \"sum\") return this.#typed(this.checked(b, call(\"result\", local(acc)), \"a finite sum\", opError()), \"number\");\n nonEmpty();\n return this.#typed(this.checked(b, call(\"result\", prim(\"/\", local(acc), local(n))), \"a finite mean\", opError()), \"number\");\n case \"min\":\n case \"max\":\n this.#loop(target, inner, at, b, items, (body, _key, v) => {\n this.#number(v, opCheck(body), s, numbers);\n firstThen(body, v, () => prim(op, local(acc), v));\n count(body);\n });\n nonEmpty();\n return this.#typed(local(acc), \"number\");\n case \"any\":\n case \"all\":\n case \"none\":\n init(bool(op === \"all\"));\n this.#loop(target, inner, at, b, items, (body, _key, v) => {\n body.stmts.push({ t: \"set\", n: acc, value: prim(op === \"all\" ? \"&&\" : \"||\", local(acc), this.#boolean(v, opCheck(body), s, { t: \"items\", op, what: \"booleans\", path })) });\n });\n return op === \"none\" ? prim(\"!\", local(acc)) : this.#typed(local(acc), \"boolean\");\n case \"first\":\n this.#loop(target, inner, at, b, items, (body, _key, v) => {\n firstThen(body, v, () => local(acc));\n count(body);\n });\n nonEmpty();\n return local(acc);\n case \"values\":\n case \"keys\":\n init(array());\n this.#loop(target, inner, at, b, items, (body, key, v) => {\n body.stmts.push({ t: \"push\", n: acc, value: op === \"keys\" ? key : v });\n });\n return this.value(b, call(\"frozen\", local(acc)));\n case \"errors\":\n this.#loop(target, inner, at, b, items, () => undefined);\n return this.value(b, call(\"frozen\", array()));\n case \"reduce\":\n this.#loop(target, inner, at, b, items, (body, _key, v) => {\n firstThen(body, v, (later) => this.checked(later, call(\"step\", name as LExpr, local(acc), v), \"a step of reduce\", this.site(later, s, { t: \"step\", path }, name as LExpr)));\n count(body);\n });\n // An empty list can give the identity of the op, so tier 1 gives its result. Without one identity, it is an error.\n if (this.#emptyFails(e)) this.check(plain, prim(\"!==\", local(n), num(0)), \"a list that is not empty\");\n else this.#decide(b, prim(\"!==\", local(n), num(0)), \"a list that is not empty\");\n return local(acc);\n }\n }\n\n /**\n * This method tells if a `reduce` of an empty list always gives an error (LIST.EMPTY). The name of its op is a literal,\n * and the domains do not have exactly one identity of the op. An option can name a domain, so a third argument tells nothing.\n */\n #emptyFails(e: ExprOf<\"app\">): boolean {\n const name = e.args[1] as Expr;\n return e.args.length === 2 && name.tag === \"lit\" && this.#facts.identities(name.value as string) !== 1;\n }\n\n /**\n * This method lowers the loop over the targets of an axis. The tests of `where` and the body evaluate at each target\n * in a block whose failure is `items(label)`. Then `onItem` adds the statements for the value of the body.\n */\n /**\n * This method gives the key of an address. The expressions of its computed moves evaluate first, at the position of\n * the node, and their child indexes start at `first` (NAV.COMPUTED).\n */\n #address(at: Addr, s: Scope, path: readonly number[], first: number, b: Block): LExpr {\n const values = addrExprs(at).map((x, i) => this.expr(x, s, [...path, first + i], b));\n const moves = values.length === 0 ? [] : [array(...values)];\n return this.checked(b, call(\"addr\", s.space, s.origin, s.focus, this.constant(at), ...moves), \"an address\", this.site(b, s, { t: \"addr\", at, path }, s.space, ...moves));\n }\n\n #loop(e: ExprOf<\"each\">, s: Scope, path: readonly number[], b: Block, items: (label: number) => Fail, onItem: (body: Block, key: LExpr, value: LExpr) => void): void {\n this.#targetLoop(e, s, path, 1, b, items, (body, key, at, names) => {\n onItem(body, key, this.expr(e.body, { ...at, env: new Map([...at.env, ...names]) }, [...path, 0], body));\n });\n }\n\n /**\n * This method lowers the loop over the targets of an axis with an address. The list of the axis `list` has the child\n * index `firstTest`. The tests of `where` come next, and the expressions of the address come after them. `each` adds\n * the statements of a target. The map `names` has the names `as` of the item. Only the body or the step reads them.\n */\n #targetLoop(\n e: Pick<ExprOf<\"each\">, \"axis\" | \"at\" | \"as\">,\n s: Scope,\n path: readonly number[],\n firstTest: number,\n b: Block,\n items: (label: number) => Fail,\n each: (body: Block, key: LExpr, at: Scope, names: ReadonlyMap<string, Bound>) => void,\n ): void {\n const { axis, at: addr, as } = e;\n this.#loops++;\n const list = listOf(axis);\n const tests = firstTest + axisChildren(axis) - whereTests(axis).length;\n const from = addr === undefined || addr.length === 0 ? s.focus : this.#address(addr, s, path, firstTest + axisChildren(axis), b);\n const base = baseAxis(axis);\n let space = s.space;\n let over: LExpr;\n let skip: LExpr | undefined;\n // The index of the record of each target: the index of the loop, or else the index that the axis gives.\n let idx: LExpr | undefined;\n // The value and the position of each item of the axis list.\n let item: { readonly values: LExpr; readonly nth: LExpr } | undefined;\n if (list !== undefined) {\n // The list evaluates at the key of the address (AXIS.LIST).\n const moved: Scope = from === s.focus ? s : { ...s, focus: from, rec: prim(\"get\", s.space, from), slot: undefined };\n const value = this.value(b, this.expr(list, moved, [...path, firstTest], b));\n const targets = this.checked(b, call(\"items\", value, bool(base.t === \"reverse\")), \"a list of the axis list\", this.site(b, moved, { t: \"listAxis\", path }, value));\n over = prim(\"keysOf\", targets);\n item = { values: prim(\"valuesOf\", targets), nth: prim(\"idxOf\", targets) };\n } else if (base.t === \"table\") {\n // The axis table moves the evaluation to the space of its table, and there the origin is the target.\n space = this.checked(b, call(\"table\", local(TABLES), this.constant(base.name)), \"a table\", this.#text(b, s, path, errorText.noTable(base.name)));\n over = call(\"keys\", space);\n } else if (base.t === \"all\" || base.t === \"others\") {\n over = call(\"keys\", s.space);\n if (base.t === \"others\") skip = from;\n } else {\n const targets = this.checked(b, { t: \"targets\", axis: this.index(base), args: [s.space, s.origin, from] }, \"the targets of an axis\", this.site(b, s, { t: \"axis\", axis: base, path }, s.space, from));\n over = prim(\"keysOf\", targets);\n idx = this.value(b, prim(\"idxOf\", targets));\n }\n // A key of a list can be outside the space, and it has no index of the space, so the record comes from the key.\n const records = list === undefined ? this.value(b, prim(\"records\", space)) : undefined;\n const label = this.labels++;\n const array_ = this.locals++;\n const index = this.locals++;\n const target = this.locals++;\n const key = local(target);\n const body = block(items(label));\n if (skip !== undefined) body.stmts.push({ t: \"if\", cond: prim(\"===\", key, skip), yes: [{ t: \"next\" }], no: [] });\n const slot = idx === undefined ? local(index) : prim(\"member\", idx, local(index));\n const rec = records === undefined ? prim(\"get\", space, key) : prim(\"recordAt\", records, slot, space, key);\n const at: Scope = { space, origin: base.t === \"table\" ? key : s.origin, focus: key, env: s.env, fns: s.fns, rec, columns: s.columns, slot: list === undefined ? slot : undefined };\n whereTests(axis).forEach((test, i) => {\n const testPath = [...path, tests + i];\n const ok = this.#boolean(this.expr(test, at, testPath, body), body, at, { t: \"test\", path: testPath });\n body.stmts.push({ t: \"if\", cond: prim(\"!\", ok), yes: [{ t: \"next\" }], no: [] });\n });\n const names = new Map<string, Bound>();\n const [name, position] = as ?? [];\n if (name !== undefined && item !== undefined) names.set(name, { value: this.value(body, prim(\"member\", item.values, local(index))) });\n if (position !== undefined && item !== undefined) names.set(position, { value: this.#typed(this.value(body, prim(\"member\", item.nth, local(index))), \"number\") });\n each(body, key, at, names);\n this.#loops--;\n b.stmts.push({ t: \"loop\", label, item: target, index, array: array_, over, body: body.stmts });\n }\n\n /** This method gives a local for each name of a loop, with its first value at the node (LOOP.NAMES). */\n #loopNames(init: Names, s: Scope, path: readonly number[], b: Block): { readonly env: ReadonlyMap<string, Bound>; readonly locals: ReadonlyMap<string, number> } {\n const env = new Map(s.env);\n const locals = new Map<string, number>();\n Object.entries(init).forEach(([name, x], i) => {\n const value = this.expr(x, s, [...path, i], b);\n const n = this.locals++;\n b.stmts.push({ t: \"let\", n, value });\n this.#typed(local(n), this.kindOf(value));\n env.set(name, { value: local(n) });\n locals.set(name, n);\n });\n return { env, locals };\n }\n\n /**\n * This method lowers one step of a loop: each new value first, and then each name gets its value. A name keeps the\n * kind of its first value, so a new value of another kind stops the program, and tier 1 evaluates it.\n */\n #loopStep(step: Names, s: Scope, path: readonly number[], first: number, b: Block, locals: ReadonlyMap<string, number>): void {\n const values = Object.entries(step).map(([name, x], i): [number, LExpr] => {\n const n = locals.get(name) as number;\n const value = this.value(b, this.expr(x, s, [...path, first + i], b));\n return [n, this.#declared(b, value, this.kindOf(local(n)), \"a value of the kind of a name of a loop\")];\n });\n for (const [n, value] of values) b.stmts.push({ t: \"set\", n, value });\n }\n\n /** This method lowers an iteration (ITERATE.LIMIT, ITERATE.UNTIL): a repeated block with a count of its steps. */\n #iterate(e: ExprOf<\"iterate\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const first = Object.keys(e.init).length;\n const tests = first + Object.keys(e.step).length;\n const { env, locals } = this.#loopNames(e.init, s, path, b);\n const inner: Scope = { ...s, env };\n const limit = this.#limit(e, s, path, tests, b);\n const untilAt = tests + axisChildren(limitAxis(e) ?? { t: \"all\" });\n const label = this.labels++;\n const k = this.typedLocal(\"number\");\n b.stmts.push({ t: \"let\", n: k, value: num(0) });\n const body = block(b.fail);\n if (e.until !== undefined) {\n const stop = this.#boolean(this.expr(e.until, inner, [...path, untilAt], body), body, inner, { t: \"until\", path: [...path, untilAt] });\n body.stmts.push({ t: \"check\", ok: prim(\"!\", stop), reason: \"the test until\", fail: { t: \"break\", label } });\n }\n // At the limit, an iteration without a test ends, and an iteration with a test fails.\n const more = prim(\"!==\", local(k), limit);\n if (e.until === undefined) body.stmts.push({ t: \"check\", ok: more, reason: \"the limit of iterate\", fail: { t: \"break\", label } });\n else this.check(body, more, \"the limit of iterate\", this.site(body, s, { t: \"limit\", path }, limit));\n this.#loopStep(e.step, inner, path, first, body, locals);\n body.stmts.push({ t: \"set\", n: k, value: prim(\"+\", local(k), num(1)) });\n b.stmts.push({ t: \"repeat\", label, body: body.stmts });\n return this.expr(e.result, inner, [...path, untilAt + (e.until === undefined ? 0 : 1)], b);\n }\n\n /**\n * This method lowers a fixed point (FIX.ROUNDS). The column is an array with the value of each key, in the order of\n * the keys. The rows of `init` give its first values, and each round makes the array of the next values. A round\n * without a change ends the loop with the old array, as the interpreter does. After the last round, an error stops\n * the column (FIX.LIMIT). The value of the node is the row of the focus.\n */\n #fix(e: ExprOf<\"fix\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const n = this.locals++;\n const column: FixColumn = { local: local(n), join: e.join };\n b.stmts.push({ t: \"let\", n, value: array() });\n this.#rows(e, e.init, s, path, 0, b, (row, _at, v) => {\n row.stmts.push({ t: \"push\", n, value: v });\n });\n const limit = this.value(b, call(\"rounds\", s.space));\n const label = this.labels++;\n const k = this.typedLocal(\"number\");\n b.stmts.push({ t: \"let\", n: k, value: num(0) });\n const body = block(b.fail);\n this.check(body, prim(\"!==\", local(k), limit), \"the limit of the rounds\", this.site(body, s, { t: \"fixLimit\", name: e.name, path }, limit));\n const next = this.locals++;\n const changed = this.locals++;\n body.stmts.push({ t: \"let\", n: next, value: array() }, { t: \"let\", n: changed, value: bool(false) });\n // The step has the column in its scope, so an inner `fix` with the same name hides the column.\n this.#rows(e, e.step, { ...s, columns: new Map([...s.columns, [e.name, column]]) }, path, 1, body, (row, at, v) => {\n const old = this.value(row, prim(\"member\", column.local, at.slot as LExpr));\n const value = this.value(row, prim(JOINS[e.join], old, v));\n row.stmts.push({ t: \"if\", cond: prim(\"!==\", value, old), yes: [{ t: \"set\", n: changed, value: bool(true) }], no: [] }, { t: \"push\", n: next, value });\n });\n body.stmts.push(\n { t: \"check\", ok: local(changed), reason: \"a round that changes a row\", fail: { t: \"break\", label } },\n { t: \"set\", n, value: local(next) },\n { t: \"set\", n: k, value: prim(\"+\", local(k), num(1)) },\n );\n b.stmts.push({ t: \"repeat\", label, body: body.stmts });\n return this.#rowOf(e.name, column, s, path, b);\n }\n\n /**\n * This method lowers the evaluation of `x` at each row of a column. An error in a row does not stop the next rows, so\n * each extension of the round evaluates (FIX.ERROR). After the loop, the errors of the rows give the error of the\n * node. `each` adds the statements of a row with a good value.\n */\n #rows(e: ExprOf<\"fix\">, x: Expr, s: Scope, path: readonly number[], child: number, b: Block, each: (row: Block, at: Scope, value: LExpr) => void): void {\n const errors = this.locals++;\n b.stmts.push({ t: \"let\", n: errors, value: array() });\n const kind: ErrorSite = { t: \"row\", name: e.name, join: e.join, path };\n // Stryker disable next-line ArrowFunction: each check of a row is in its own block, so the loop reads no failure\n this.#targetLoop(ROWS, s, path, 0, b, () => b.fail, (body, _key, at) => {\n const row = this.#attempt(\n body,\n (inner) => {\n const v = this.value(inner, this.expr(x, at, [...path, child], inner));\n if (joinKind(e.join) === \"boolean\") this.#boolean(v, inner, at, kind);\n else this.check(inner, prim(\"isFinite\", v), \"a finite number\", this.site(inner, at, kind, v));\n each(inner, at, v);\n return v;\n },\n true,\n );\n body.stmts.push({ t: \"if\", cond: prim(\"!\", row.ok as LExpr), yes: [{ t: \"push\", n: errors, value: row.value }], no: [] });\n });\n const site = this.constants.push({ t: \"rows\", path } satisfies ErrorSite) - 1;\n this.check(b, prim(\"===\", prim(\"member\", local(errors), this.constant(\"length\")), num(0)), \"the rows have values\", call(\"args\", { t: \"site\", i: site }, s.origin, s.focus, local(errors)));\n }\n\n /** This method reads the row of the focus. A focus that is not a key of the space has no row (FIX.LAST). */\n #rowOf(name: string, column: FixColumn, s: Scope, path: readonly number[], b: Block): LExpr {\n const x = this.value(b, prim(\"member\", column.local, s.slot ?? call(\"rowIndex\", s.space, s.focus)));\n this.check(b, prim(\"isValue\", x), \"a row of the column\", this.site(b, s, { t: \"lastKey\", name, path }));\n return this.#typed(x, joinKind(column.join));\n }\n\n /**\n * This method gives the number of steps of an iteration. A data limit counts the targets of its axis. Its failure\n * stops the program, and tier 1 gives the error (ITERATE.LIMIT.ERROR).\n */\n #limit(e: ExprOf<\"iterate\">, s: Scope, path: readonly number[], firstTest: number, b: Block): LExpr {\n const axis = limitAxis(e);\n if (axis === undefined) return num(e.limit as number);\n const n = this.typedLocal(\"number\");\n b.stmts.push({ t: \"let\", n, value: num(0) });\n // The error of a limit that is not valid keeps its cause, so each failure here is the plain failure of the block.\n // COMPILE.EXT: the interpreter evaluates each test, and an extension in a test can give #DEPTH!. Thus a failed test stops the program.\n const plain: Block = { stmts: b.stmts, fail: axisExprs(axis).some((x) => this.#mayExt(x, s.fns)) ? STOP : plainOf(b.fail) };\n this.#targetLoop({ axis }, s, path, firstTest, plain, () => plain.fail, (body) => {\n body.stmts.push({ t: \"set\", n, value: prim(\"+\", local(n), num(1)) });\n });\n this.check(b, prim(\"===\", prim(\"min\", local(n), num(MAX_ITERATIONS)), local(n)), \"a data limit in the cap\");\n return local(n);\n }\n\n /** This method lowers a fold (FOLD.ORDER): the loop over the targets, with a step at each target. */\n #fold(e: ExprOf<\"fold\">, s: Scope, path: readonly number[], b: Block): LExpr {\n const first = Object.keys(e.init).length;\n const tests = first + Object.keys(e.step).length;\n const { env, locals } = this.#loopNames(e.init, s, path, b);\n // An error of a test or of a step is the error of the fold.\n this.#targetLoop(e, s, path, tests, b, () => b.fail, (body, _key, at, names) => {\n this.#loopStep(e.step, { ...at, env: new Map([...env, ...names]) }, path, first, body, locals);\n });\n return this.expr(e.result, { ...s, env }, [...path, tests + axisChildren(e.axis) + addrExprs(e.at).length], b);\n }\n}\n\nconst NEGATIVE_ZERO = Symbol(\"-0\");\n\n/** This function gives the flag of a bound value: its local, or `true` for a value without a flag. */\n// Stryker disable next-line BooleanLiteral: a value without a flag always exists, so each constant gives the same entries\nconst flag = (b: Bound): LExpr => b.ok ?? bool(true);\n","/**\n * The runtime of generated code. Each function follows the rule of the interpreter of the core. Where the interpreter\n * gives an error value, the function gives `FALLBACK`, and it records the detail of the failure in two variables. On the\n * value path, the runtime makes no error values and no `Result` objects (docs/COMPILER.md §4.1). A list op on a list\n * value or an array is the exception: it runs the code of the interpreter (COMPILE.LIST.VALUE, COMPILE.LIST.ARRAY).\n *\n * The failure path of generated code keeps a lazy error: the site, the position and the operands. When the program ends\n * with it, `take` gives the error of the interpreter. It uses the error texts of the core (`materialize`).\n *\n * Generated code uses the runtime inside a `try`, and an exception gives `FALLBACK` for the whole program. Tier 1 then\n * gives the result. A function of the runtime catches an exception only where the interpreter makes a value of it. In\n * an op, it is `#CALC!`, and in `safeIs`, it is `false`. A full call stack is `#DEPTH!`, which no list op and no\n * `ifError` hides, so it goes on to the program. An extension throws for `#DEPTH!` too (COMPILE.EXT).\n */\nimport {\n axisTargets,\n errorAt,\n errorText,\n findMethod,\n fixRounds,\n fixValueError,\n isDepthError,\n isListOp,\n isStackOverflow,\n asList,\n isVexList,\n liftsAt,\n listOps,\n matchesKind,\n fixAddr,\n noKeyError,\n resolveAddr,\n safeIs,\n vexError,\n vexList,\n worstRow,\n type Addr,\n type AnyDomain,\n type Axis,\n type ErrorExtra,\n type ErrorText,\n type FixedMove,\n type FreeFn,\n type ParamKind,\n type Position,\n type Result,\n type Space,\n type VexError,\n} from \"@mark1russell7/vex\";\nimport { entryOf, type Entry, type Method, type Options } from \"./facts.ts\";\nimport type { ErrorSite } from \"./loop.ts\";\n\n/** The value of a program that stops at a failed check. */\nexport const FALLBACK: unique symbol = Symbol(\"vex.fallback\");\nexport type Fallback = typeof FALLBACK;\n\n/** The options that a runtime keeps: the domains, the free functions and the extension handlers. */\nexport type RuntimeOptions = Options;\n\n/**\n * The dispatch of one op name and one number of arguments. With up to 3 arguments, it takes the values themselves, the\n * receiver first. With more, it takes an array of the values. Generated code also reads its fields: the method of the\n * last receiver, the function of the op of the first domain, and the free function.\n */\nexport interface Site {\n (...values: never[]): unknown;\n m: Method | undefined;\n readonly fn: Method | undefined;\n readonly free: FreeFn | undefined;\n}\n\n/** A base axis: an axis that is not `where`. */\nexport type BaseAxis = Exclude<Axis, { readonly t: \"where\" }>;\n\n/** The targets of an axis at a focus: the keys, and the index of each key in `keys` of the space. */\nexport interface Targets {\n readonly keys: readonly string[];\n readonly idx: readonly (number | undefined)[];\n}\n\n/** The targets of the axis `list`: the key, the value and the position of each item, in the order of the loop. */\nexport interface ListTargets extends Targets {\n readonly values: readonly unknown[];\n}\n\n/** An entry of a memo: the value of a node for one space, or no value after an error. */\nexport interface MemoEntry {\n readonly v: unknown;\n readonly ok: boolean;\n}\n\n/**\n * The memo of one node: an entry for each space and each value of the keys (docs/COMPILER.md §7.2 and §7.3). An entry\n * with an object or a function in its keys is not kept, because each run can make a new one.\n */\nexport interface Memo {\n get(s: Space, keys: readonly unknown[]): MemoEntry | undefined;\n put(s: Space, keys: readonly unknown[], v: unknown, ok: boolean): MemoEntry;\n}\n\n/** A level of a memo: the entry of the keys so far, and the levels of the next key. */\ninterface MemoLevel {\n entry?: MemoEntry;\n next?: Map<unknown, MemoLevel>;\n}\n\n/** A map key does not tell 0 from -0, but an op can. Thus -0 has its own key. */\nconst NEGATIVE_ZERO = Symbol(\"-0\");\n\n/** This function tells if a memo keeps an entry with these keys: keys without objects and functions. */\nconst kept = (keys: readonly unknown[]): boolean => keys.every((k) => (typeof k !== \"object\" || k === null) && typeof k !== \"function\");\n\n/**\n * The detail of the failure of an op or of an extension, with the meaning of the two variables of the record:\n * - `threw`: an op threw, and `a` is the thrown value.\n * - `lift`: `fromScalar` threw. `a` is the thrown value, and `b` the name of the domain.\n * - `valid`: a check `valid` threw. `a` is the thrown value, and `b` the name of the domain.\n * - `bad`: a result failed its checks, and `a` is the result.\n * - `param`: an argument has the wrong kind, and `a` is a `ParamFailure`.\n * - `no-op`: no domain and no function has the op. `a` tells if the op has a receiver, and `b` is the receiver.\n * - `no-step`: no domain gives a step of `reduce`, and `a` is the accumulator.\n * - `no-handler`: an extension has no handler.\n * - `foreign`: a handler gave an error, and `a` is the error.\n * - `list`: a list op or `fill` gave an error of its own, and `a` is the error.\n */\ntype Detail = \"threw\" | \"lift\" | \"valid\" | \"bad\" | \"param\" | \"no-op\" | \"no-step\" | \"no-handler\" | \"foreign\" | \"list\";\n\n/** An argument of an op that does not have the kind of its parameter. */\ninterface ParamFailure {\n readonly index: number;\n readonly value: unknown;\n readonly kind: ParamKind;\n readonly domain: string;\n}\n\n/**\n * A failure that the program keeps: its site, its position, its operands and the detail of the runtime. `materialize`\n * makes the error of it only if the error is the result of the program.\n */\nexport interface LazyError {\n readonly site: ErrorSite;\n readonly origin: string;\n readonly focus: string;\n readonly operands: readonly unknown[];\n readonly detail: Detail;\n readonly a: unknown;\n readonly b: unknown;\n}\n\n/** The functions of the runtime. The names are the names of `RuntimeFn` in the loop IR. */\nexport interface Runtime {\n readonly F: Fallback;\n has(s: Space, key: string): boolean;\n /** This function gives the key of an address. `values` has the values of its computed moves (NAV.COMPUTED). */\n addr(s: Space, origin: string, focus: string, at: Addr, values?: readonly unknown[]): unknown;\n /**\n * This function gives the function of the targets of one base axis. A space does not change, so the targets stay in\n * a cache for each space and focus. Generated code gets it once, when it loads.\n */\n axis(axis: BaseAxis): (s: Space, origin: string, focus: string) => Targets | Fallback;\n table(tables: Readonly<Record<string, Space>> | undefined, name: string): unknown;\n keys(s: Space): readonly string[];\n /** This function gives the index of a key in the keys of a space, or `undefined` for a key outside the space. */\n rowIndex(s: Space, key: string): number | undefined;\n /** This function gives the largest number of rounds of a column of a space (FIX.LIMIT). */\n rounds(s: Space): number;\n /** This function gives the dispatch of an op name with `arity` arguments. Generated code gets it once, when it loads. */\n site(name: string, arity: number): Site;\n /** This function gives a new memo. Generated code gets one for each node of the memo, when it loads. */\n memo(): Memo;\n /** This function gives the domain at an index of the options. */\n domain(index: number): AnyDomain | undefined;\n /** An exception of an op is the error #CALC! of that op, so this function gives `FALLBACK`. A full call stack goes on. */\n threw(thrown: unknown): Fallback;\n /** This function records a result that failed its checks. It gives `FALLBACK`. */\n bad(value: unknown): Fallback;\n /** This function records an exception of the check `valid` of the domain at an index. It gives `FALLBACK`. */\n invalid(thrown: unknown, domain: number): Fallback;\n /** This function gives the lazy error of a failed check, with the record of the last failure. */\n err(site: ErrorSite, origin: string, focus: string, ...operands: readonly unknown[]): LazyError;\n /** This function gives the lazy error of the arguments that failed, as `#all` of the interpreter: `undefined` for no error. */\n args(site: ErrorSite, origin: string, focus: string, errors: readonly (LazyError | undefined)[]): LazyError | undefined;\n /** This function ends a program with a lazy error. It gives `FALLBACK`, so `load` keeps its contract. */\n raise(error: LazyError): Fallback;\n /** This function gives the error of the last `raise`, once. It gives `undefined` when the run ended in another way. */\n take(): VexError | undefined;\n step(name: string, acc: unknown, value: unknown): unknown;\n result(value: unknown): unknown;\n opts(value: unknown): unknown;\n rec(names: readonly string[], values: readonly unknown[]): unknown;\n list(keys: readonly string[], values: readonly unknown[]): unknown;\n /**\n * This function gives the targets of the axis `list` (AXIS.LIST): the keys, the values and the positions of the items.\n * A value that is not a list gives `FALLBACK`, and the site gives the error. Generated code makes no error item, so an\n * error item throws, and tier 1 gives the result.\n */\n items(value: unknown, reverse: boolean): ListTargets | Fallback;\n frozen(values: readonly unknown[]): unknown;\n ext(kind: string, data: unknown, s: Space, origin: string, focus: string, path: readonly number[]): unknown;\n var(vars: Readonly<Record<string, unknown>> | undefined, name: string): unknown;\n}\n\n/** The path and the position of a call of a list op. An error with this path is an error of the op, not of an item. */\nconst HERE: readonly number[] = [];\nconst NOWHERE: Position = { origin: \"\", focus: \"\" };\n\n/** The interpreter reads the own enumerable properties of the variables, with `Object.entries`. */\nconst hasVar = (vars: Readonly<Record<string, unknown>> | undefined, name: string): vars is Readonly<Record<string, unknown>> => vars !== undefined && Object.prototype.propertyIsEnumerable.call(vars, name);\n\n/** This function makes the runtime of one set of options. */\nexport function createRuntime(options: RuntimeOptions): Runtime {\n const domains = options.domains ?? [];\n const fns = options.fns;\n const extensions = options.extensions ?? {};\n const F: Fallback = FALLBACK;\n const lists = listOps(options);\n\n // The record of the last failure. Each failure writes it before `err` reads it, and a failure makes no object here.\n let detail: Detail = \"threw\";\n let detailA: unknown;\n let detailB: unknown;\n // The error of the last `raise`.\n let raised: LazyError | undefined;\n const record = (d: Detail, a?: unknown, b?: unknown): Fallback => {\n detail = d;\n detailA = a;\n detailB = b;\n return F;\n };\n\n // An exception of an op, of `fromScalar` or of a check `valid`.\n const failure = (d: Detail, thrown: unknown, domain?: string): Fallback => {\n if (isStackOverflow(thrown)) throw thrown;\n return record(d, thrown, domain);\n };\n const threw = (thrown: unknown): Fallback => failure(\"threw\", thrown);\n\n // The checks of the result of an op: a value, a finite number, and a valid value of its first domain.\n const checked = (value: unknown): unknown => {\n if (value === undefined || value === null) return record(\"bad\", value);\n if (typeof value === \"number\" && !Number.isFinite(value)) return record(\"bad\", value);\n for (const d of domains) {\n if (!safeIs(d, value)) continue;\n if (d.valid === undefined) return value;\n try {\n return d.valid(value) ? value : record(\"bad\", value);\n } catch (thrown) {\n return failure(\"valid\", thrown, d.name);\n }\n }\n return value;\n };\n\n // The call of an op, as `#call` of the interpreter: the lift of numbers, the kinds of the parameters, the call, and\n // the checks of the result.\n const invoke = (e: Entry, call: (args: readonly unknown[]) => unknown, rest: readonly unknown[]): unknown => {\n const lift = e.spec.liftScalar;\n const from = e.domain.fromScalar;\n let args = rest;\n if (lift && from !== undefined) {\n try {\n args = rest.map((a, i): unknown => (typeof a === \"number\" && liftsAt(lift, i) ? from(a) : a));\n } catch (thrown) {\n return failure(\"lift\", thrown, e.domain.name);\n }\n }\n const params = e.spec.params;\n if (params !== undefined) {\n const index = args.findIndex((a, i) => !matchesKind(params[i] ?? \"any\", a, e.domain));\n if (index !== -1) return record(\"param\", { index, value: args[index], kind: params[index] ?? \"any\", domain: e.domain.name } satisfies ParamFailure);\n }\n let value: unknown;\n try {\n value = call(args);\n } catch (thrown) {\n return threw(thrown);\n }\n return checked(value);\n };\n\n // The op of a name for a receiver: the first domain that accepts the receiver and has the op. `undefined` is no op.\n // `seen` receives each method that the dispatch finds.\n const dispatch = (entries: readonly (Entry | undefined)[], name: string, values: readonly unknown[], seen?: (m: Method) => void): unknown => {\n const [self, ...rest] = values;\n for (const e of entries) {\n if (e === undefined || !safeIs(e.domain, self)) continue;\n const fn = e.fn;\n if (fn !== undefined) return invoke(e, (args) => fn(self, ...args), rest);\n const method = findMethod(self, name);\n if (method === undefined) continue;\n seen?.(method);\n return invoke(e, (args) => method.apply(self, [...args]), rest);\n }\n return undefined;\n };\n\n const entriesOf = (name: string): readonly (Entry | undefined)[] => domains.map((d) => entryOf(d, name));\n\n // The result of a list op: the code of the interpreter, for each list (COMPILE.LIST.VALUE). An error of the op is an\n // error of the site. #DEPTH! and the error of an item stop the program, so tier 1 gives the result (V-064, V-066).\n const listResult = (r: Result<unknown>): unknown => {\n if (r.ok) return r.value;\n // Stryker disable next-line StringLiteral: the program catches the exception, so no one reads its message\n if (r.error.path !== HERE || isDepthError(r.error)) throw new Error(\"tier 1 gives the error of a list op\");\n return record(\"list\", r.error);\n };\n\n // The entries of the op names of reduce. A program can compute such a name, so the runtime keeps them by name.\n const stepEntries = new Map<string, readonly (Entry | undefined)[]>();\n\n // This function gives the error of a result that failed its checks, as `#checkResult` of the interpreter.\n const badText = (op: string, value: unknown): ErrorText => {\n if (value === undefined || value === null) return errorText.noValue(op);\n if (typeof value === \"number\" && !Number.isFinite(value)) return errorText.notFinite(op, value);\n // The checks of a domain gave this failure, so a domain accepts the value.\n return errorText.invalid(op, (domains.find((d) => safeIs(d, value)) as AnyDomain).name);\n };\n\n // This function gives the error of a failure of an op without a domain, as the end of `#app` of the interpreter.\n const noOpText = (op: string, receiver: boolean, self: unknown): ErrorText => {\n const accepted = receiver ? domains.find((d) => safeIs(d, self)) : undefined;\n if (accepted !== undefined) return errorText.domainNoOp(accepted.name, op);\n return receiver ? errorText.noDomain(op, self) : errorText.noOp(op);\n };\n\n // This function gives the error of a failure of the op `op`, from the record of the failure.\n const opError = (e: LazyError, op: string, path: readonly number[], at: (text: ErrorText, extra?: ErrorExtra) => VexError): VexError => {\n switch (e.detail) {\n case \"list\":\n return { ...(e.a as VexError), path, origin: e.origin, focus: e.focus };\n case \"threw\":\n return at(errorText.threw(op), { thrown: e.a });\n case \"lift\":\n return at(errorText.threw(`${e.b as string}.fromScalar`), { thrown: e.a });\n case \"valid\":\n return at(errorText.validThrew(op, e.b as string), { thrown: e.a });\n case \"bad\":\n return at(badText(op, e.a));\n case \"param\": {\n const p = e.a as ParamFailure;\n return at(errorText.badParam(op, p.index, p.value, p.kind, p.domain));\n }\n case \"no-step\":\n return at(errorText.noStep(op, e.a));\n // The two details of an extension have no op site, so this case is the only other detail.\n case \"no-op\":\n case \"foreign\":\n case \"no-handler\":\n return at(noOpText(op, e.a as boolean, e.b));\n }\n };\n\n // This function gives the error of an extension, as `#guard` and `#locate` of the interpreter.\n const extError = (e: LazyError, kind: string, pos: Position, path: readonly number[], at: (text: ErrorText, extra?: ErrorExtra) => VexError): VexError => {\n if (e.detail === \"threw\") return at(errorText.threw(kind), { thrown: e.a });\n if (e.detail === \"no-handler\") return at(errorText.noHandler(kind));\n const error = e.a as VexError;\n return error.origin === undefined ? { ...error, path, origin: pos.origin, focus: pos.focus } : error;\n };\n\n /** This function makes the error of a lazy error: the error of the interpreter, with the texts of the core. */\n const materialize = (e: LazyError): VexError => {\n const { site, operands } = e;\n if (site.t === \"key\") return noKeyError(e.origin);\n const pos = { origin: e.origin, focus: e.focus };\n const { path } = site;\n const at = (text: ErrorText, extra?: ErrorExtra): VexError => errorAt(text, pos, path, extra);\n const [first, second] = operands;\n switch (site.t) {\n case \"text\":\n return at(site.text);\n case \"call\": {\n const vars = first as Readonly<Record<string, unknown>> | undefined;\n return at(hasVar(vars, site.name) ? errorText.notFunction(site.name) : errorText.noFunction(site.name));\n }\n case \"missing\":\n return at(errorText.missing(first as string, site.where));\n case \"boolean\":\n return at(errorText.notBoolean(site.op, site.i, first));\n case \"items\":\n return at(errorText.needsItems(site.op, site.what, first));\n case \"until\":\n return at(errorText.untilKind(first));\n case \"limit\":\n return at(errorText.limit(first as number));\n case \"test\":\n return at(errorText.whereKind(first));\n case \"listAxis\":\n return at(errorText.axisList(first));\n case \"op\":\n return opError(e, site.op, path, at);\n case \"step\":\n return opError(e, first as string, path, at);\n case \"ext\":\n return extError(e, site.kind, pos, path, at);\n case \"addr\": {\n const values = second as readonly unknown[] | undefined;\n const fixed = values === undefined ? undefined : fixAddr(site.at, values, pos);\n if (fixed?.ok === false) return { ...fixed.error, path };\n const r = resolveAddr(first as Space, pos, fixed === undefined ? (site.at as readonly FixedMove[]) : fixed.value);\n return { ...(r as Extract<typeof r, { readonly ok: false }>).error, path };\n }\n case \"axis\": {\n const r = axisTargets(first as Space, { origin: e.origin, focus: second as string }, site.axis);\n return { ...(r as Extract<typeof r, { readonly ok: false }>).error, path };\n }\n case \"args\":\n return at(errorText.args(operands.length, site.what), { causes: (operands as readonly LazyError[]).map(materialize) });\n case \"fixLimit\":\n return at(errorText.fixLimit(site.name, first as number));\n case \"row\":\n return at(fixValueError(site.name, site.join, first) as ErrorText);\n case \"lastKey\":\n return at(errorText.lastKey(site.name, e.focus));\n case \"rows\": {\n const causes = (operands as readonly LazyError[]).map(materialize);\n return worstRow(causes) ?? at(errorText.args(causes.length, \"rows\"), { causes });\n }\n }\n };\n\n // The index of each key of a space, for the targets of an axis. A miss of the cache only makes the map again.\n const indexes = new WeakMap<Space, ReadonlyMap<string, number>>();\n const indexOf = (s: Space): ReadonlyMap<string, number> => {\n let m = indexes.get(s);\n // Stryker disable next-line ConditionalExpression: see the comment above\n if (m === undefined) {\n m = new Map(s.keys.map((k, i) => [k, i]));\n // Stryker disable next-line CallExpression: see the comment above\n indexes.set(s, m);\n }\n return m;\n };\n\n return {\n F,\n has: (s, key) => s.has(key),\n addr(s, origin, focus, at, values) {\n const pos = { origin, focus };\n // An address without computed moves has no values, and its moves are fixed.\n // Stryker disable next-line ConditionalExpression: fixAddr gives the same fixed moves, so the test only saves an array\n const fixed = values === undefined ? undefined : fixAddr(at, values, pos);\n if (fixed?.ok === false) return F;\n const r = resolveAddr(s, pos, fixed === undefined ? (at as readonly FixedMove[]) : fixed.value);\n return r.ok ? r.value : F;\n },\n axis(axis) {\n const cache = new WeakMap<Space, Map<string, Targets | Fallback>>();\n return (s, origin, focus) => {\n let byFocus = cache.get(s);\n if (byFocus === undefined) {\n byFocus = new Map();\n cache.set(s, byFocus);\n }\n let targets = byFocus.get(focus);\n if (targets === undefined) {\n const r = axisTargets(s, { origin, focus }, axis);\n const index = indexOf(s);\n targets = r.ok ? { keys: r.value, idx: r.value.map((k) => index.get(k)) } : F;\n byFocus.set(focus, targets);\n }\n return targets;\n };\n },\n table(tables, name) {\n const t = tables !== undefined && Object.hasOwn(tables, name) ? tables[name] : undefined;\n return t ?? F;\n },\n keys: (s) => s.keys,\n rowIndex: (s, key) => indexOf(s).get(key),\n rounds: (s) => fixRounds(s.keys.length),\n // The dispatch of `app` in the interpreter: the first domain that accepts the receiver and has the op, and else a\n // free function. Generated code has the fast path of each site, and it uses this dispatch for each other case.\n site(name, arity) {\n const entries = entriesOf(name);\n const listOp = isListOp(name);\n const fn = fns !== undefined && Object.hasOwn(fns, name) ? fns[name] : undefined;\n const generic = (values: readonly unknown[]): unknown => {\n if (listOp && isVexList(values[0])) return listResult(lists.list(name, values[0], values.slice(1), NOWHERE, HERE));\n if (values.length > 0) {\n const r = dispatch(entries, name, values, (m) => {\n site.m = m;\n });\n if (r !== undefined) return r;\n }\n // LIST.ARRAY: after the domains and the function of the host, a list op on an array is a list op on a list.\n if (listOp && fn === undefined && Array.isArray(values[0])) {\n const r = lists.array(name, values[0], values.slice(1), NOWHERE, HERE);\n // The value of `errors` has the position of the call, and a site has no position (COMPILE.LIST.ARRAY). FALLBACK\n // is an error, and a list op skips an error item, so an exception must stop the program (V-064).\n // Stryker disable next-line StringLiteral: the program catches the exception, so no one reads its message\n if (name === \"errors\" && r.ok && (r.value as readonly unknown[]).length > 0) throw new Error(\"tier 1 gives the errors of an array\");\n return listResult(r);\n }\n if (name === \"fill\" && fn === undefined) return listResult(lists.fill(values, NOWHERE, HERE));\n try {\n if (fn === undefined) return record(\"no-op\", values.length > 0, values[0]);\n return checked(fn(...values));\n } catch (thrown) {\n return threw(thrown);\n }\n };\n const call = arity <= 3 ? (...values: unknown[]): unknown => generic(values) : generic;\n const site: Site = Object.assign(call, { m: undefined, fn: entries.find((e) => e !== undefined)?.fn, free: fn });\n return site;\n },\n memo() {\n const spaces = new WeakMap<Space, MemoLevel>();\n // The level of a space and some keys. With `make`, the function makes each missing level. A level that a read\n // makes only uses memory, so the checks of `make` have no other effect.\n const level = (s: Space, keys: readonly unknown[], make: boolean): MemoLevel | undefined => {\n let at: MemoLevel | undefined = spaces.get(s);\n if (at === undefined) {\n // A read comes before each write, so the level of the space exists for each write.\n // Stryker disable next-line ConditionalExpression,BooleanLiteral: see the comments above\n if (!make) return undefined;\n at = {};\n spaces.set(s, at);\n }\n for (const k of keys) {\n // Stryker disable next-line UnaryOperator: with +0 as the special key, 0 and -0 still get different entries\n const slot = Object.is(k, -0) ? NEGATIVE_ZERO : k;\n let next: MemoLevel | undefined = at.next?.get(slot);\n if (next === undefined) {\n // Stryker disable next-line ConditionalExpression: see the comment above\n if (!make) return undefined;\n next = {};\n (at.next ??= new Map()).set(slot, next);\n }\n at = next;\n }\n return at;\n };\n return {\n // Stryker disable next-line BooleanLiteral: a read that makes the levels only uses memory\n get: (s, keys) => level(s, keys, false)?.entry,\n put(s, keys, v, ok) {\n const e = { v, ok };\n if (kept(keys)) (level(s, keys, true) as MemoLevel).entry = e;\n return e;\n },\n };\n },\n domain: (index) => domains[index],\n threw,\n bad: (value) => record(\"bad\", value),\n invalid: (thrown, domain) => failure(\"valid\", thrown, (domains[domain] as AnyDomain).name),\n err: (site, origin, focus, ...operands) => ({ site, origin, focus, operands, detail, a: detailA, b: detailB }),\n args(site, origin, focus, errors) {\n const failed = errors.filter((e) => e !== undefined);\n return failed.length < 2 ? failed[0] : { site, origin, focus, operands: failed, detail, a: undefined, b: undefined };\n },\n raise(error) {\n raised = error;\n return F;\n },\n take() {\n const e = raised;\n if (e === undefined) return undefined;\n raised = undefined;\n return materialize(e);\n },\n // One step of `reduce`: the first domain that accepts the accumulator and has the op. No free function.\n step(name, acc, value) {\n let entries = stepEntries.get(name);\n // Stryker disable ConditionalExpression,BlockStatement,CallExpression: a miss of the cache only reads the op tables again\n if (entries === undefined) {\n entries = entriesOf(name);\n stepEntries.set(name, entries);\n }\n // Stryker restore ConditionalExpression,BlockStatement,CallExpression\n return dispatch(entries, name, [acc, value]) ?? record(\"no-step\", acc);\n },\n result(value) {\n try {\n return checked(value);\n } catch (thrown) {\n return threw(thrown);\n }\n },\n // A list op reads the option `strict` of its options. The read can throw, as in the interpreter.\n opts: (value) => (value as { readonly strict?: unknown } | null | undefined)?.strict,\n // Object.fromEntries gives an own field for each name, also for \"__proto__\" (V-062).\n rec: (names, values) => Object.freeze(Object.fromEntries(names.map((n, i) => [n, values[i]]))),\n list: (keys, values) => vexList(keys.map((key, i) => ({ key, result: { ok: true, value: values[i] } }))),\n items(value, reverse) {\n // Stryker disable next-line ArrowFunction,StringLiteral: an error item throws below, so no one reads this error\n const listed = asList(value, (message) => vexError(\"kind-mismatch\", message, NOWHERE));\n if (listed === undefined) return F;\n const keys: string[] = [];\n const values: unknown[] = [];\n const idx: number[] = [];\n for (const { key, result } of listed.items) {\n // Stryker disable next-line StringLiteral: the program catches the exception, so no one reads its message\n if (!result.ok) throw new Error(\"tier 1 gives the axis list over an error item\");\n keys.push(key);\n values.push(result.value);\n idx.push(idx.length);\n }\n return reverse ? { keys: keys.toReversed(), values: values.toReversed(), idx: idx.toReversed() } : { keys, values, idx };\n },\n frozen: (values) => Object.freeze([...values]),\n ext(kind, data, s, origin, focus, path) {\n const handler = Object.hasOwn(extensions, kind) ? extensions[kind] : undefined;\n if (handler === undefined) return record(\"no-handler\");\n let r: ReturnType<typeof handler>;\n try {\n r = handler(data, { space: s, position: { origin, focus }, path });\n } catch (thrown) {\n // As for an op: an exception is #CALC!, and a full call stack goes on to the program.\n return threw(thrown);\n }\n if (r.ok) return r.value;\n // EVAL.DEPTH: no list op and no ifError hides #DEPTH!, so it stops the program as an exception (COMPILE.EXT).\n // Stryker disable next-line StringLiteral: the program catches the exception, so no one reads its message\n if (isDepthError(r.error)) throw new Error(\"an extension gave #DEPTH!\");\n return record(\"foreign\", r.error);\n },\n var: (vars, name) => (hasVar(vars, name) ? vars[name] : F),\n };\n}\n","/**\n * The tiers (docs/COMPILER.md §2.1). Tier 2 is generated JavaScript, and it gives its values and its error results. Tier\n * 1 is the closure compiler of the core, and it gives each result that tier 2 cannot give. Thus a tiered program gives\n * the results of the interpreter.\n */\nimport { compile, fail, fromDocument, isDocument, monotoneError, ok, sizeError, stepError, type CompileOptions, type Envelope, type Expr, type Program, type Space, type VexError } from \"@mark1russell7/vex\";\nimport { factsOf, type Schema } from \"./facts.ts\";\n\n/** The options of the compiler: the options of `compile`, and the schema of the host (docs/COMPILER.md §3.2). */\nexport type GenerateOptions = CompileOptions & { readonly schema?: Schema };\nimport { printJs } from \"./js.ts\";\nimport type { LoopProgram } from \"./loop.ts\";\nimport { lower, Unsupported } from \"./lower.ts\";\nimport { createRuntime, FALLBACK } from \"./runtime.ts\";\n\n/**\n * The output of `generate`: the loop IR and the source of a program, and the options that the source is for. Or else\n * the reason that the compiler cannot lower the program.\n */\nexport type Generated =\n | { readonly ok: true; readonly program: LoopProgram; readonly source: string; readonly options: GenerateOptions }\n | { readonly ok: false; readonly reason: string };\n\n/** A function of tier 2. It gives the value of the program, or `FALLBACK` for each other result. */\nexport type Tier2 = (space: Space, origin: string, vars: Readonly<Record<string, unknown>> | undefined, tables: Readonly<Record<string, Space>> | undefined) => unknown;\n\n/** This function gives the reason that tier 1 refuses a program with a good shape, or `undefined`. */\nconst refusal = (e: Expr, options: GenerateOptions): string | undefined => sizeError(e, options) ?? stepError(e, options) ?? monotoneError(e, options);\n\n/**\n * This function lowers an expression or a document and prints its source for the options (DOC.ENTRY). The op tables of\n * the domains give the fast path of each op site. It is pure, so a build can use it.\n */\nexport function generate(source: Expr | Envelope, options: GenerateOptions = {}): Generated {\n // DOC.ENTRY: a document gives its expression first, or the reason that it is not valid.\n const read = isDocument(source) ? fromDocument(source, options.domains) : ok(source);\n if (!read.ok) return { ok: false, reason: read.error.message };\n try {\n const facts = factsOf(options);\n const program = lower(read.value, facts, options.schema);\n // LOOP.SIZE, STEP.MAX: tier 2 refuses the programs that tier 1 refuses. The lowering checks the shape and the nesting first.\n const size = refusal(read.value, options);\n if (size !== undefined) return { ok: false, reason: size };\n return { ok: true, program, source: printJs(program, facts), options };\n } catch (thrown) {\n // A stack overflow in the lowering of a deep expression also goes to tier 1.\n return { ok: false, reason: thrown instanceof Unsupported ? thrown.message : \"the lowering threw an exception\" };\n }\n}\n\n/**\n * This function makes the function of tier 2 with `new Function`, with the options of the source. It throws on a page\n * that does not permit `new Function`.\n */\nexport function load(generated: Extract<Generated, { readonly ok: true }>): Tier2 {\n return link(generated).run;\n}\n\n/** This function loads a program, with the function that gives the error of a run that gave `FALLBACK`. */\nfunction link(generated: Extract<Generated, { readonly ok: true }>): { readonly run: Tier2; readonly take: () => VexError | undefined } {\n const runtime = createRuntime(generated.options);\n // oxlint-disable-next-line typescript/no-implied-eval -- the source comes from printJs, and it reads each name and literal from K (§5).\n const make = new Function(\"K\", \"R\", generated.source) as (k: readonly unknown[], r: ReturnType<typeof createRuntime>) => Tier2;\n return { run: make(generated.program.constants, runtime), take: () => runtime.take() };\n}\n\n/** The counts of the runs of a tiered program. */\nexport interface TierStats {\n /** The number of runs. */\n readonly runs: number;\n /** The number of runs where tier 2 gave no result, so tier 1 gave it. A run that tier 2 ends with an error is no fallback. */\n readonly fallbacks: number;\n}\n\n/** A program with tiers. It has the interface `Program` of the core, so it can replace a compiled program. */\nexport interface TieredProgram extends Program {\n /** The tier of the program: 2 when it has generated code, and else 1. */\n readonly tier: 1 | 2;\n /** The reason that the program has no generated code. */\n readonly reason?: string;\n readonly stats: TierStats;\n}\n\n/**\n * This function compiles an expression or a document into tier 2 if it can, and else into tier 1 (DOC.ENTRY). Tier 2\n * gives a value or an error. When it gives no result, tier 1 does that evaluation again. A run with a trace and\n * `explain` always use tier 1, because tier 2 makes no trace.\n */\nexport function tiered(source: Expr | Envelope, options: GenerateOptions = {}): TieredProgram {\n const slow = compile(source, options);\n // The program of tier 1 has the expression of a document, so tier 2 does not read the document again.\n const { expr } = slow;\n const generated = generate(expr, options);\n let fast: ReturnType<typeof link> | undefined;\n let reason: string | undefined;\n if (generated.ok) {\n try {\n fast = link(generated);\n } catch {\n reason = \"the page does not permit new Function\";\n }\n } else {\n reason = generated.reason;\n }\n const stats = { runs: 0, fallbacks: 0 };\n return {\n expr,\n tier: fast === undefined ? 1 : 2,\n ...(reason === undefined ? {} : { reason }),\n stats,\n run(r) {\n stats.runs++;\n if (fast === undefined || r.trace !== undefined) return slow.run(r);\n const value = fast.run(r.space, r.origin, r.vars, r.tables);\n if (value !== FALLBACK) return ok(value);\n const error = fast.take();\n if (error !== undefined) return fail(error);\n stats.fallbacks++;\n return slow.run(r);\n },\n explain: (r) => slow.explain(r),\n };\n}\n"],"mappings":";;;AAoMA,MAAa,SAAS,OAAsB;CAAE,GAAG;CAAS;AAAE;AAC5D,MAAa,YAAY,OAAsB;CAAE,GAAG;CAAS;AAAE;AAC/D,MAAa,OAAO,OAAsB;CAAE,GAAG;CAAO;AAAE;AACxD,MAAa,QAAQ,OAAuB;CAAE,GAAG;CAAQ;AAAE;AAC3D,MAAa,gBAAuB,EAAE,GAAG,WAAW;AACpD,MAAa,SAAe,OAAO,OAAO,EAAE,GAAG,SAAS,CAAC;AACzD,MAAa,OAAa,OAAO,OAAO,EAAE,GAAG,OAAO,CAAC;AACrD,MAAa,SAAS,GAAG,WAA2B;CAAE,GAAG;CAAS;AAAM;AACxE,MAAa,QAAQ,IAAY,GAAG,UAA0B;CAAE,GAAG;CAAQ;CAAI;AAAK;AACpF,MAAa,QAAQ,IAAe,GAAG,UAA0B;CAAE,GAAG;CAAQ;CAAI;AAAK;;AAGvF,SAAgB,MAAM,GAAkB;CACtC,QAAQ,EAAE,GAAV;EACE,KAAK,UACH,OAAO;EACT,KAAK,QACH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