parseman 0.59.1 → 0.59.3

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.
Files changed (68) hide show
  1. package/README.md +5 -4
  2. package/dist/analysis/commitment.d.ts +1 -1
  3. package/dist/analysis/diagnostics.js +4 -4
  4. package/dist/analysis/diagnostics.js.map +1 -1
  5. package/dist/cli/index.js +4 -4
  6. package/dist/cli/index.js.map +1 -1
  7. package/dist/combinators/completions.d.ts +3 -3
  8. package/dist/combinators/completions.d.ts.map +1 -1
  9. package/dist/combinators/gate.d.ts +1 -1
  10. package/dist/compiler/compile-linkable-table.d.ts +2 -3
  11. package/dist/compiler/compile-linkable-table.d.ts.map +1 -1
  12. package/dist/compiler/linker.d.ts.map +1 -1
  13. package/dist/cst/host-mode.d.ts +1 -1
  14. package/dist/cst/root-trivia-scope.d.ts +1 -1
  15. package/dist/index.js +4 -4
  16. package/dist/index.js.map +1 -1
  17. package/dist/language-service/index.d.ts +1 -1
  18. package/dist/language-service/index.js.map +1 -1
  19. package/dist/plugin/entry-supercompiler.d.ts.map +1 -1
  20. package/dist/plugin/index.d.ts +3 -7
  21. package/dist/plugin/index.d.ts.map +1 -1
  22. package/dist/plugin/index.js +4 -4
  23. package/dist/plugin/index.js.map +1 -1
  24. package/dist/spec/index.js.map +1 -1
  25. package/dist/table/assemble.d.ts +2 -3
  26. package/dist/table/assemble.d.ts.map +1 -1
  27. package/dist/table/compile-rule-map.d.ts +3 -2
  28. package/dist/table/compile-rule-map.d.ts.map +1 -1
  29. package/dist/table/compile.d.ts +2 -2
  30. package/dist/table/emit.d.ts +4 -5
  31. package/dist/table/emit.d.ts.map +1 -1
  32. package/dist/table/encode.d.ts +6 -7
  33. package/dist/table/encode.d.ts.map +1 -1
  34. package/dist/table/exec.d.ts.map +1 -1
  35. package/dist/table/index.js +4 -4
  36. package/dist/table/index.js.map +1 -1
  37. package/dist/table/ops.d.ts +20 -20
  38. package/dist/table/ops.d.ts.map +1 -1
  39. package/dist/table/program.d.ts +7 -7
  40. package/dist/types.d.ts +1 -1
  41. package/dist/version.d.ts +6 -6
  42. package/package.json +1 -1
  43. package/src/analysis/commitment.ts +1 -1
  44. package/src/analysis/terminal.ts +1 -1
  45. package/src/combinators/choice.ts +1 -1
  46. package/src/combinators/completions.ts +3 -3
  47. package/src/combinators/gate.ts +1 -1
  48. package/src/compiler/compile-linkable-table.ts +2 -3
  49. package/src/compiler/degradation.ts +2 -2
  50. package/src/compiler/linker.ts +5 -3
  51. package/src/cst/capture-buffer.ts +2 -2
  52. package/src/cst/host-mode.ts +1 -1
  53. package/src/cst/root-trivia-scope.ts +1 -1
  54. package/src/language-service/index.ts +1 -1
  55. package/src/plugin/entry-supercompiler.ts +2 -1
  56. package/src/plugin/index.ts +11 -16
  57. package/src/table/assemble.ts +9 -10
  58. package/src/table/compile-rule-map.ts +4 -3
  59. package/src/table/compile.ts +3 -3
  60. package/src/table/emit-assembly.ts +4 -4
  61. package/src/table/emit.ts +13 -14
  62. package/src/table/encode.ts +14 -15
  63. package/src/table/exec.ts +4 -5
  64. package/src/table/ops.ts +20 -20
  65. package/src/table/program.ts +7 -7
  66. package/src/table/stamp.ts +1 -1
  67. package/src/types.ts +1 -1
  68. package/src/version.ts +6 -6
@@ -1,25 +1,25 @@
1
1
  /**
2
2
  * Opcodes for the TABLE lowering (design ledger row G5).
3
3
  *
4
- * The premise, stated so it can be falsified: today every rule's recognizer is
5
- * INLINED BESPOKE into its own emitted function, so an artifact pays the full
6
- * cost of the recognition machinery once PER RULE (measured: ~4.9 kB for a
7
- * `node()` rule; ~186 B for each additional call site). Emitting a rule as a
8
- * TABLE ROW interpreted by one shared driver moves that machinery out of the
9
- * artifact and into the runtime, where it is emitted ONCE for all grammars and
10
- * all variants.
4
+ * The source lowering this replaced (removed in 0.47.0) inlined every rule's
5
+ * recognizer into its own emitted function, so an artifact paid for the
6
+ * recognition machinery once PER RULE (measured then: ~4.9 kB for a `node()`
7
+ * rule; ~186 B for each additional call site). As TABLE ROWS run by one shared
8
+ * driver, that machinery lives in the runtime, once for all grammars and all
9
+ * variants.
11
10
  *
12
11
  * The instruction stream is a flat `number[]`: `code[ip]` is the opcode and the
13
12
  * operands follow it inline. Child instructions are referenced by ABSOLUTE code
14
- * offset, never by nesting, so the driver is a plain recursive read — no node
15
- * objects, no closures, no per-combinator allocation.
13
+ * offset, never by nesting.
16
14
  *
17
- * Operand layouts are documented per opcode below and are the contract between
18
- * `encode.ts` and `exec.ts`. Nothing else may read the stream.
15
+ * Operand layouts are documented per opcode below. `encode.ts` writes them; the
16
+ * engines (`assemble.ts`, `emit-assembly.ts`, the reference `exec.ts`) and the
17
+ * table analyses (`child-slots.ts`, `site-labels.ts`, `fail-clean.ts`, …) read
18
+ * them.
19
19
  */
20
- /** `LIT k` — `k` indexes a string in the const pool. */
20
+ /** `LIT k fx` — `k` indexes a string in the const pool; `fx` the expected set on failure. */
21
21
  export declare const OP_LIT = 1;
22
- /** `RX k` — `k` indexes a STICKY `RegExp` in the const pool. */
22
+ /** `RX k fx` — `k` indexes a STICKY `RegExp` in the const pool; `fx` as `LIT`. */
23
23
  export declare const OP_RX = 2;
24
24
  /** `SEQ n c1 … cn` — n child offsets; value is the array of their values. */
25
25
  export declare const OP_SEQ = 3;
@@ -79,9 +79,9 @@ export declare const OP_XFORM = 9;
79
79
  export declare const OP_NODE = 10;
80
80
  /** `RULE r` — `r` indexes `prog.rules`. */
81
81
  export declare const OP_RULE = 11;
82
- /** `GATE cc c` — first-char gate: `cc` indexes a char class; then run `c`. */
82
+ /** `GATE cc c fx` — first-char gate: `cc` indexes a char class; then run `c`. `fx` is the set reported when the gate rejects. */
83
83
  export declare const OP_GATE = 12;
84
- /** `NOT c` — zero-width negative lookahead. */
84
+ /** `NOT c fx` — zero-width negative lookahead; `fx` is the assertion's own set, as `PEEK`. */
85
85
  export declare const OP_NOT = 13;
86
86
  /**
87
87
  * `PEEK c fx` — zero-width positive lookahead. `fx` is the ASSERTION's own set,
@@ -200,10 +200,10 @@ export declare const OP_LIT_CI_TRACK = 28;
200
200
  */
201
201
  export declare const OP_TOKEN = 29;
202
202
  /**
203
- * `SCOPE_CAP k c` — a `parser({ trivia, captureTrivia: true })` scope. Identical
203
+ * `SCOPE_CAP k c policy` — a `parser({ trivia, captureTrivia: true })` scope. Identical
204
204
  * operands to `SCOPE`; it additionally sets `ctx.captureTrivia` for the child.
205
205
  *
206
- * A SEPARATE OPCODE rather than a third operand on `SCOPE`, for two reasons.
206
+ * A SEPARATE OPCODE rather than another operand on `SCOPE`, for two reasons.
207
207
  * Widening an instruction means every walker that knows its shape has to learn
208
208
  * the new one, and there is no central arity table here to change in one place.
209
209
  * And the driver should SELECT this piece, not test a flag inside the scope
@@ -256,7 +256,7 @@ export declare const OP_GUARD = 32;
256
256
  * would become a no-op and `notAdjacent()` a guaranteed failure. So the SEQ
257
257
  * pieces read this row at assembly and run the test themselves, exactly as
258
258
  * `sequence()` forks `parseAdjacent` (combinators/sequence.ts:118) and as
259
- * codegen lowers it at the boundary (codegen.ts:1765).
259
+ * the source lowering lowered it at the boundary.
260
260
  *
261
261
  * Reached as a row in its own right only where there IS no boundary — a bare
262
262
  * choice arm, a `node()` body, a repeat item. The interpreter throws there
@@ -366,7 +366,7 @@ export declare const OP_ARMGATE = 36;
366
366
  * library never sees.
367
367
  *
368
368
  * It exists because codegen accepts exactly this and delegates at run time
369
- * (`compiler/codegen.ts`, `emitRuntimeFallback`'s `_rp[i].parse(...)` row). The
369
+ * (the source lowering's `emitRuntimeFallback`). The
370
370
  * encoder used to throw `UnsupportedConstruct`, so the table lowering REJECTED
371
371
  * grammars the source lowering compiles, and the two lowerings must accept the
372
372
  * same language.
@@ -435,7 +435,7 @@ export declare const OP_LABEL = 39;
435
435
  * `on` is 0 for ENTRY and 1 for SUCCESS, and it is read at ASSEMBLY TIME, never
436
436
  * per parse: `assemble.ts` picks one of two closures from it, exactly as it picks
437
437
  * pieces from `RunCfg`. The two phases are not decoration — the source lowering
438
- * credits a RULE on entry (`codegen.ts:4529`) and a choice arm, dispatch arm or
438
+ * credited a RULE on entry and a choice arm, dispatch arm or
439
439
  * label only once it has SUCCEEDED, and a table that credited all four alike
440
440
  * would report a different denominator's worth of hits than the engine it is a
441
441
  * drop-in for.
@@ -1 +1 @@
1
- {"version":3,"file":"ops.d.ts","sourceRoot":"","sources":["../../src/table/ops.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,wDAAwD;AACxD,eAAO,MAAM,MAAM,IAAI,CAAA;AACvB,gEAAgE;AAChE,eAAO,MAAM,KAAK,IAAI,CAAA;AACtB,6EAA6E;AAC7E,eAAO,MAAM,MAAM,IAAI,CAAA;AACvB,iFAAiF;AACjF,eAAO,MAAM,OAAO,IAAI,CAAA;AACxB;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,IAAI,CAAA;AAC1B;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,IAAI,CAAA;AACvB,2CAA2C;AAC3C,eAAO,MAAM,OAAO,IAAI,CAAA;AACxB;;;;kDAIkD;AAClD,eAAO,MAAM,MAAM,IAAI,CAAA;AACvB,qEAAqE;AACrE,eAAO,MAAM,QAAQ,IAAI,CAAA;AACzB;;;;;;;;;;;;;;;;;;;;;iCAqBiC;AACjC,eAAO,MAAM,OAAO,KAAK,CAAA;AACzB,2CAA2C;AAC3C,eAAO,MAAM,OAAO,KAAK,CAAA;AACzB,8EAA8E;AAC9E,eAAO,MAAM,OAAO,KAAK,CAAA;AACzB,+CAA+C;AAC/C,eAAO,MAAM,MAAM,KAAK,CAAA;AACxB;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,KAAK,CAAA;AACzB,oEAAoE;AACpE,eAAO,MAAM,OAAO,KAAK,CAAA;AACzB,0CAA0C;AAC1C,eAAO,MAAM,QAAQ,KAAK,CAAA;AAC1B;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,KAAK,CAAA;AAC9B,eAAO,MAAM,WAAW,KAAK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CAAA;AAC3B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,SAAS,KAAK,CAAA;AAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,UAAU,KAAK,CAAA;AAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,OAAO,KAAK,CAAA;AACzB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,UAAU,KAAK,CAAA;AAC5B;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ,KAAK,CAAA;AAC1B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,MAAM,KAAK,CAAA;AACxB;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,KAAK,CAAA;AAChC;;;;;;;;;GASG;AACH;kFACkF;AAClF,eAAO,MAAM,WAAW,KAAK,CAAA;AAC7B,0EAA0E;AAC1E,eAAO,MAAM,cAAc,KAAK,CAAA;AAChC,oFAAoF;AACpF,eAAO,MAAM,cAAc,KAAK,CAAA;AAChC;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,KAAK,CAAA;AAC1B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,KAAK,CAAA;AAC7B;;;;GAIG;AACH,eAAO,MAAM,SAAS,KAAK,CAAA;AAE3B,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAe3C,CAAA"}
@@ -22,10 +22,10 @@ export type PrecompiledAssembly = {
22
22
  /**
23
23
  * The emitted form of a grammar under the table lowering.
24
24
  *
25
- * This object is ALL a grammar contributes to a bundle. Every line of
26
- * recognition logic lives in `exec.ts`, which ships once in the runtime and is
27
- * shared by every grammar and every variant. A rule costs its row, not a
28
- * function.
25
+ * This object is ALL a grammar contributes to a bundle, apart from any
26
+ * build-time assemblies in `asm`. The recognition logic is the shared driver
27
+ * (`tableRules`, `assemble.ts`), which ships once in the runtime for every
28
+ * grammar and every variant. A rule costs its row, not a function.
29
29
  *
30
30
  * Serialized shape is deliberately JSON-ish (numbers, strings, and a pool of
31
31
  * author callbacks) so the emitter can print it as a literal.
@@ -138,9 +138,9 @@ export type TableProgram = {
138
138
  */
139
139
  readonly triviaSpecs?: readonly TriviaSpec[];
140
140
  /**
141
- * 1 when this table was encoded with `TableSettings.recovery` — the sequences
142
- * carry their inferred follow-set classes and the repetitions their item
143
- * expected-set and separator sentinel class.
141
+ * Always 1: every table carries recovery operands — the sequences their inferred
142
+ * follow-set classes, the repetitions their item expected set and separator
143
+ * sentinel class. (`TableSettings.recovery` is a deprecated no-op.)
144
144
  *
145
145
  * TABLE DATA, read once when the driver/assembly is built. It selects the
146
146
  * recovery pieces; it is not a per-parse option, and a recovery table still
package/dist/types.d.ts CHANGED
@@ -670,7 +670,7 @@ export type GatedArm<T = unknown> = {
670
670
  * This lives with the rest of the library's types rather than inside a lowering
671
671
  * because it is the shape BOTH lowerings answer to: `table/compile.ts` returns it
672
672
  * today and is what `src/index.ts` exports as `compile`. It started in
673
- * `compiler/codegen.ts`, which made the table import its own public contract from
673
+ * the source lowering, which made the table import its own public contract from
674
674
  * the engine the table replaced — backwards, and a reason the engine could not be
675
675
  * deleted.
676
676
  */
package/dist/version.d.ts CHANGED
@@ -4,14 +4,14 @@
4
4
  *
5
5
  * ── ARTIFACTS ARE VERSION-LOCKED ────────────────────────────────────────────────
6
6
  * A grammar is compiled AND fused/linked by the SAME parseman version. Parseman does
7
- * NOT read a compiled artifact produced by a different version. The compiled-artifact
8
- * format (`firstSetRecipes`, `LinkablePieces`, the fused-body shape, …) may therefore
9
- * change freely between versions and carries NO back-compat shim: `fusedBody` refuses
10
- * to link a serialized artifact stamped with a different version, and there is no
11
- * "legacy format" read path. If you find yourself adding one, STOP — it is dead code.
7
+ * NOT read a compiled artifact produced by a different version. The artifact formats
8
+ * (the table program, `LinkableTable`, carried IR) may therefore change freely between
9
+ * versions and carry NO back-compat shim and no "legacy format" read path. If you find
10
+ * yourself adding one, STOP — it is dead code. The stamp is written but not yet checked
11
+ * on read (#186).
12
12
  *
13
13
  * Kept in sync with `package.json` by `test/unit/version-sync.test.ts`, which fails
14
14
  * the build if this constant drifts from the published version.
15
15
  */
16
- export declare const PARSEMAN_VERSION = "0.59.1";
16
+ export declare const PARSEMAN_VERSION = "0.59.3";
17
17
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parseman",
3
- "version": "0.59.1",
3
+ "version": "0.59.3",
4
4
  "packageManager": "pnpm@10.15.1",
5
5
  "engines": {
6
6
  "node": "^20.19.0 || >=22.13.0"
@@ -404,7 +404,7 @@ export function hasNodeDef(p: Combinator<unknown>, seen: Set<Combinator<unknown>
404
404
  *
405
405
  * It belongs in THIS module for the reason stated at the top of it: both lowerings
406
406
  * must reach the same answer, and a stamp they disagree about is a driver that
407
- * accepts a host it should refuse. It previously lived in `compiler/codegen.ts`,
407
+ * accepts a host it should refuse. It previously lived in the source lowering,
408
408
  * which forced `table/compile-rule-map.ts` to import the engine the table replaced.
409
409
  *
410
410
  * The descent mirrors the source lowering's own `childrenOf` exactly — including a
@@ -252,7 +252,7 @@ export function render(lines: readonly Line[], target: RenderTarget = {}): strin
252
252
  }
253
253
 
254
254
  // linecraft's own escapes, for the one component whose plain form is not otherwise
255
- // reachable. Mirrors `packages/compiler/src/diagnostics.ts:246`. Built from a char code
255
+ // reachable. Built from a char code
256
256
  // so the ESC byte cannot be lost in transit the way the old constant table's was.
257
257
  const ESC = String.fromCharCode(27)
258
258
  const OSC8 = new RegExp(`${ESC}\\]8;;.*?${ESC}\\\\`, 'g')
@@ -314,7 +314,7 @@ function bareLeadingTermKey(term: Combinator<unknown>): string | null {
314
314
  //
315
315
  // A `lazy` ref lead — excluded for correctness, not for want of a key. The
316
316
  // once-only prescan runs with `ctx.capturing = false`, which suppresses capture
317
- // only for code emitted HERE (emitLeafCapture, codegen.ts). A ref compiles to a
317
+ // only for code emitted HERE (the source lowering's emitLeafCapture). A ref compiles to a
318
318
  // call into a function body generated under its OWN ctx (emitLazy), so its
319
319
  // captures and trivia writes would happen during the prescan and then AGAIN in
320
320
  // each arm. Replaying a ref needs recorded-and-spliced capture state, not the
@@ -3,8 +3,8 @@ import { REC } from '../recovery/scan.ts'
3
3
  import { createParseContext } from '../parse-context.ts'
4
4
 
5
5
  /** Anything `completionsAt` can probe: an interpreter combinator OR a `compile()`d
6
- * grammar. A grammar compiled with `{ recovery: true }` records the probe on its fast
7
- * path, so completions work on the published compiled artifact — no interpreter needed. */
6
+ * grammar, which records the probe on its fast path. A macro-built rule function has
7
+ * neither `parse` nor `parseWithContext`, so it is not accepted. */
8
8
  type CompletionsTarget =
9
9
  | Combinator<unknown>
10
10
  | { parseWithContext(input: string, ctx: ParseContext, pos?: number): ParseResult<unknown> }
@@ -17,7 +17,7 @@ type CompletionsTarget =
17
17
  * highest-position failure seen, even when sepBy/many backtrack past the cursor.
18
18
  * Returns the expected tokens from that deepest failure.
19
19
  *
20
- * Works on the interpreter combinator OR a `compile(g, { recovery: true })` grammar
20
+ * Works on the interpreter combinator OR a `compile()`d grammar
21
21
  * (the probe is recorded on the compiled fast path). Returns an empty array when the
22
22
  * input up to `offset` parses completely with no failures at or before the cursor.
23
23
  *
@@ -15,7 +15,7 @@ import type { Combinator, ParseContext, ParseResult, ParserMeta } from '../types
15
15
  * Naming: this matches the `gate:` field on a gated CHOICE arm
16
16
  * (`choice({ gate, combinator }, other)`). Use the arm FIELD to SELECT a branch by
17
17
  * a cheap state predicate; use this COMBINATOR to ASSERT a state predicate
18
- * mid-sequence. Formerly named `guard()` — see the deprecated alias in `guard.ts`.
18
+ * mid-sequence. Formerly named `guard()`; that alias was removed in 0.45.0.
19
19
  *
20
20
  * Note: like all state predicates its first-set is `any`, so a `gate(...)` as the
21
21
  * LEADING term of a choice arm poisons that choice's first-char dispatch. Keep it
@@ -29,9 +29,8 @@ import { PARSEMAN_VERSION } from '../version.ts'
29
29
  * artifact is a table, not a bag of compiled functions.
30
30
  * `ir` — the piece's combinator graph, serialized. This is the
31
31
  * composable half, and it is NOT new machinery: the plugin
32
- * already carries pieces as IR (`plugin/index.ts:1772`) and
33
- * the linker already re-lowers them (`linker.ts:640`,
34
- * `compileLinkable(evalRuleMapIR(p.ir), …)` at build time).
32
+ * already carries pieces as IR (`plugin/index.ts`) and the
33
+ * macro re-lowers them from it at build time.
35
34
  *
36
35
  * ── WHY THAT MAKES COMPOSITION THE EASY KIND ─────────────────────────────────
37
36
  * The open question was whether table-to-table composition has to merge two
@@ -93,8 +93,8 @@ export function formatDegradations(list: readonly Degradation[]): string[] {
93
93
  //
94
94
  // Compilation is single-module and synchronous, so a module-level sink (opened per
95
95
  // transform, drained after) records findings without threading a field through every
96
- // Ctx and every compile*() return — the same shape as the regex-lowering sink in
97
- // codegen.ts, for the same reason.
96
+ // Ctx and every compile*() return — the same shape as the source lowering's regex-lowering
97
+ // sink, for the same reason.
98
98
  // ---------------------------------------------------------------------------
99
99
  //
100
100
  // A STACK, not a single slot. `transformMacro` re-enters itself when it lowers a private
@@ -25,9 +25,11 @@ import { copySpan } from '../line-index.ts'
25
25
  /**
26
26
  * Compile a `rules()` map to a **linkable artifact** — the composable, shippable
27
27
  * form (RULE_ABI_PLAN §4). A package exports `linkable(rules(g => …))`; consumers
28
- * import that artifact and `fuse([...])` it — **no source of the base grammar is
29
- * ever read**. Under the macro this is precompiled to static pieces; in the
30
- * interpreter it compiles here at load (like `compile()`).
28
+ * import that artifact and `compose([...])` it — **no source of the base grammar is
29
+ * ever read**. Under the macro this is precompiled to static pieces, and only a
30
+ * build-time `compose()` can link it. In the interpreter it compiles here at load
31
+ * (like `compile()`) and keeps the map's `RULES_RECIPE`, which is what a runtime
32
+ * `compose()` links; an artifact without one is refused there (`recipesOf`).
31
33
  *
32
34
  * `ns` is a per-artifact namespace; omit it to auto-assign a process-unique one
33
35
  * (fine at runtime — the macro supplies a stable module-derived ns instead).
@@ -270,8 +270,8 @@ export function rollbackCstCaptureAt(
270
270
  // speculative branch leaves no ghost error (see saveCstMark). Guarded on a
271
271
  // present sink + a defined mark (rollbackTrivia forwards the same field).
272
272
  //
273
- // Each truncation is guarded on `length !== mark`, mirroring the compiled
274
- // engine (codegen.ts `captureRestoreBody`). Assigning `array.length` runs V8's
273
+ // Each truncation is guarded on `length !== mark`, as the source lowering's
274
+ // `captureRestoreBody` did. Assigning `array.length` runs V8's
275
275
  // length setter — a backing-store trim decision — and costs the same when the
276
276
  // value is unchanged, which is the overwhelmingly common case here: a
277
277
  // speculative branch that captured nothing still pays for every store. The
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * The compiled-artifact ↔ host contract, in ONE place.
3
3
  *
4
- * This lives on its own — rather than in `compiler/codegen.ts` where it started —
4
+ * This lives on its own — rather than in the source lowering where it started —
5
5
  * because the DRIVER has to enforce it too. `functional/run.ts` is the `parseman/run`
6
6
  * entry, whose whole purpose is to stay small (see `test/unit/run-entry-closure.test.ts`),
7
7
  * so it cannot import the compiler to reach an assertion. Neither can it carry its own
@@ -2,7 +2,7 @@
2
2
  * The ROOT-CAPTURE POLICY of one local trivia scope, in one place.
3
3
  *
4
4
  * Three engines install a `parser({ trivia })` scope — the interpreter
5
- * (`combinators/grammar.ts`), source lowering (`compiler/codegen.ts`) and the
5
+ * (`combinators/grammar.ts`), the source lowering (removed in 0.47.0) and the
6
6
  * table (`table/assemble.ts`, `table/exec.ts`) — and each of them has to answer
7
7
  * the same two questions about selected root trivia. The refusal below was a
8
8
  * string literal in two of them and ABSENT from the third, which is how a table
@@ -6,7 +6,7 @@
6
6
  * name = node type, without ever modifying the grammar:
7
7
  *
8
8
  * - `parse(src, { tolerant })` → CST + `ParseError[]` (recovers on the compiled
9
- * fast path when `grammar` is a `compile(g, { recovery: true })` grammar).
9
+ * fast path when `grammar` is a `compile()`d grammar).
10
10
  * - `diagnostics(src)` → structural parse errors + your per-node-type lint rules.
11
11
  * - `completionsAt(src, offset)` → the grammar's expected-token set at the cursor,
12
12
  * mapped through your per-rule semantic completion handlers.
@@ -1,5 +1,6 @@
1
1
  /**
2
- * Experimental build-time Entry/SCC supercompiler for static table assemblies.
2
+ * Build-time Entry/SCC supercompiler for the selective assemblies a macro build
3
+ * emits (it runs on every macro build that selects sites).
3
4
  *
4
5
  * The table emitter remains the sole semantic backend. This pass parses that
5
6
  * backend's ordinary JavaScript and joins uniquely-owned piece functions with
@@ -5,8 +5,9 @@
5
5
  *
6
6
  * For each such import, walks the file's AST, finds variable declarations
7
7
  * whose RHS is a pure parseman combinator call, evaluates them at build time,
8
- * compiles the result to an optimized inline function, and replaces the
9
- * declaration — removing the import entirely.
8
+ * compiles the result to a table program (plus generated code for its hottest
9
+ * sites, within `assemblyBudget`), and replaces the declaration. The macro import
10
+ * is removed; the module imports the shared driver from `parseman/table` instead.
10
11
  *
11
12
  * Usage:
12
13
  * // vite.config.ts
@@ -61,7 +62,7 @@ import type {
61
62
  * The PUBLIC subpath, not a deep path into `src/`: this string is written into a
62
63
  * consumer's build output, so it has to be a specifier their resolver can see.
63
64
  * `parseman/table` is declared in package.json `exports` and re-exports
64
- * `tableRules` as `tableRules` (src/table/index.ts:28).
65
+ * `tableRules` unrenamed (`src/table/index.ts`).
65
66
  */
66
67
  const TABLE_RUNTIME_SPECIFIER = 'parseman/table'
67
68
 
@@ -119,13 +120,9 @@ export type ParsecraftPluginOptions = {
119
120
  */
120
121
  warnUnloweredRegex?: boolean
121
122
  /**
122
- * Bake automatic list recovery into the macro-compiled output. **Default `false`.**
123
- * When on, `many`/`oneOrMore`/`sepBy` in every compiled grammar gain a
124
- * `_ctx._tolerant`-gated recovery branch (dormant on strict parses — a normal
125
- * parse is unaffected and allocates nothing). The output stays macro-inlinable
126
- * (sentinels build via `_ctx._rec`, not `_rp`). Turn it on for grammars you drive
127
- * from an editor/language service so `run(g, src, { tolerant: true })` recovers on
128
- * the fast compiled path; leave it off for build-only grammars.
123
+ * @deprecated Has no effect: every compiled table carries recovery, and
124
+ * `run(g, src, { tolerant: true })` recovers on the compiled path whatever this is
125
+ * set to. Removed in the next minor release.
129
126
  */
130
127
  recovery?: boolean
131
128
  /** Emit grammar-coverage hooks in macro output. Off by default, so ordinary
@@ -1456,9 +1453,8 @@ function transformMacroImpl(
1456
1453
 
1457
1454
  /**
1458
1455
  * Compile a `rules(factory)` call into ONE shared replacement expression
1459
- * for the whole call — see compileRuleMap() in codegen.ts for why this is
1460
- * one shared codegen pass instead of one `compile()` per entry (a `rules()`
1461
- * factory's entries commonly share large reachable sub-rule graphs; a
1456
+ * for the whole call: one shared `compileRuleMap()` pass instead of one
1457
+ * `compile()` per entry (a `rules()` factory's entries commonly share large reachable sub-rule graphs; a
1462
1458
  * shared pass compiles each shared sub-rule once instead of once per entry
1463
1459
  * that reaches it).
1464
1460
  */
@@ -1977,9 +1973,8 @@ function transformMacroImpl(
1977
1973
  * shadows the base piece which actually defines `Pair` — the encoder then finds a
1978
1974
  * hole where the winner should be and refuses the whole grammar with "ref() used
1979
1975
  * before .define()". The same filter guards `compileLinkableTable`'s `isLocal`
1980
- * (`compile-linkable-table.ts:96`), `itemCarried` (`linker.ts:696`) and
1981
- * `recoverComposedRules`; this is the fourth site that needs it, for the same
1982
- * reason, and skipping it is why cross-piece composition looked blocked.
1976
+ * (`compile-linkable-table.ts`) and `recoverComposedRules`; this site needs it
1977
+ * for the same reason, and skipping it is why cross-piece composition looked blocked.
1983
1978
  *
1984
1979
  * The reference itself is not lost: it stays inside the delta's own rule bodies and
1985
1980
  * `enc.winners` binds it BY NAME to whichever piece supplies the definition.
@@ -4,7 +4,7 @@
4
4
  * This is ledger row G5 as stated: *"build the grammar reference at run start,
5
5
  * making the swaps on rules / sub-rules (leaves) at that point, then run with NO
6
6
  * logic branching for that option input"*. `exec.ts` builds the same table and
7
- * then interprets it: one `switch (code[ip])` over 29 opcodes, executed ONCE PER
7
+ * then interprets it: one `switch (code[ip])` over every opcode (29 then), executed ONCE PER
8
8
  * ROW — 497,360 rows for `benchmark.less` (`bench/jess/g5-rows.ts`) — each
9
9
  * re-reading its opcode and re-decoding its operands from the `Int32Array`, and
10
10
  * re-testing the same per-parse options. That is the per-node branching the
@@ -114,9 +114,8 @@ import { failCleanAnalysis } from './fail-clean.ts'
114
114
  /**
115
115
  * THE COMPLETIONS PROBE, at the terminal fail sites and nowhere else.
116
116
  *
117
- * `failAt` (combinators/probe.ts) is called from exactly three places in the
118
- * interpreter — `literal.ts`, `regex.ts`, `keywords.ts` — and codegen emits its
119
- * mirror (`probeUpdate`) at the same leaf-fail sites. The table recorded
117
+ * `failAt` (combinators/probe.ts) is called at the interpreter's terminal fail
118
+ * sites — `literal.ts`, `regex.ts`, `keywords.ts`, `lines.ts`. The table recorded
120
119
  * NOTHING, so `completionsAt` on a table artifact saw only the top-level
121
120
  * failure: a swallowed item failure inside a `sepBy` (`'{'` at offset 1 in a
122
121
  * `{ decl; }` grammar) never reached the probe and the item's opener vanished
@@ -438,7 +437,7 @@ export function assemble(t: ResolvedTable, prog: TableProgram, cfg: RunCfg): Ass
438
437
  * graph with no recovery in it anywhere.
439
438
  *
440
439
  * Dormancy is unchanged for the OTHER two engines: the source lowering
441
- * (`codegen.ts:3153`) and the interpreter (`repeat.ts:163`) still gate on
440
+ * (removed in 0.47.0) and the interpreter (`repeat.ts:163`) still gate on
442
441
  * `ctx._tolerant` at runtime, and the recovery pieces below keep their own
443
442
  * `_tolerant === true` failure-path gates so `exec.ts` stays the identity
444
443
  * reference.
@@ -1914,8 +1913,8 @@ export function assemble(t: ResolvedTable, prog: TableProgram, cfg: RunCfg): Ass
1914
1913
  const expectSpan = (ctx: ParseContext, pos: number) =>
1915
1914
  prog.lines === 1 ? spanLines(ctx, pos, pos) : new PlainSpan(pos, pos)
1916
1915
  // TOLERANT `expect()` EMBEDS ITS ERROR IN THE TREE, not only in the flat
1917
- // `_errors` side-channel (`combinators/expect.ts:150`, and codegen's
1918
- // `_ctx._rec.capture` at codegen.ts:4470) — so a tree walk finds every
1916
+ // `_errors` side-channel (`combinators/expect.ts:150`, and the source
1917
+ // lowering's `_ctx._rec.capture`) — so a tree walk finds every
1919
1918
  // diagnostic and the node survives incremental subtree reuse. The table
1920
1919
  // pushed to `_errors` and stopped, so a tolerant CST parse was missing the
1921
1920
  // `parseError` child the other two engines both produce.
@@ -2536,7 +2535,7 @@ export function assemble(t: ResolvedTable, prog: TableProgram, cfg: RunCfg): Ass
2536
2535
  *
2537
2536
  * The restore is `sequence()`'s `finally` (combinators/sequence.ts:105).
2538
2537
  * Codegen does not restore and compensates by having every list capture
2539
- * `_sync` at ENTRY (codegen.ts:3032); the table captures at entry too, so
2538
+ * `_sync` at ENTRY; the table captures at entry too, so
2540
2539
  * this is unobservable either way — it is here because leaving a stale
2541
2540
  * sentinel published is the kind of state a later reader will trust.
2542
2541
  */
@@ -3479,7 +3478,7 @@ export function assemble(t: ResolvedTable, prog: TableProgram, cfg: RunCfg): Ass
3479
3478
  * delimiter (`orSentinel`, repeat.ts:454).
3480
3479
  * - `mySync` is captured at ENTRY. An element's own sequence publishes
3481
3480
  * over `_sync` while it runs; the interpreter restores in a `finally`
3482
- * and codegen saves at entry (codegen.ts:3032) — same value, both ways.
3481
+ * and the source lowering saved at entry — same value, both ways.
3483
3482
  * - the separator-less path rolls the leading trivia back BEFORE
3484
3483
  * recovering (repeat.ts's `repItem`), and the separated path does NOT:
3485
3484
  * a consumed separator and the error after it both belong to the list
@@ -3903,7 +3902,7 @@ export function assemble(t: ResolvedTable, prog: TableProgram, cfg: RunCfg): Ass
3903
3902
  ctx._fields = wantFields ? [] : undefined
3904
3903
  // PER-NODE-TYPE TRIVIA-KIND MASK, scoped to the body and restored —
3905
3904
  // `node.ts:259-273`, and codegen's `_triviaCaptureMask` save/install/
3906
- // restore around the same scope (`codegen.ts:4130-4136`). The table
3905
+ // restore around the same scope. The table
3907
3906
  // installed nothing, so a host that asked `Outer` for comments only got
3908
3907
  // every kind the scanner saw.
3909
3908
  const savedMask = structural ? ctx._triviaCaptureMask : undefined
@@ -19,7 +19,7 @@ import { runDuplicationDiagnosticRules, type DuplicationOption } from './duplica
19
19
  * `compileRuleMap()` FOR THE TABLE LOWERING — the counterpart that did not exist.
20
20
  *
21
21
  * `compile` covered `compile()`, the SINGLE-ROOT entry point, which the
22
- * plugin uses only for standalone combinators (`plugin/index.ts:1693`, `:1870`).
22
+ * plugin uses only for standalone combinators.
23
23
  * The main path — every `rules()` grammar — goes through `compileRuleMap`, and
24
24
  * with no table counterpart there was nothing for the macro build to point at.
25
25
  * This is that function, and it is the EASY direction: `encodeTable` takes a
@@ -29,7 +29,7 @@ import { runDuplicationDiagnosticRules, type DuplicationOption } from './duplica
29
29
  * ── THE CONTRACT IT MATCHES ──────────────────────────────────────────────────
30
30
  * `compileRuleMap` returns ONE `replacement` string: a self-contained expression
31
31
  * that the plugin splices over the whole `rules(factory)` call-expression
32
- * (`plugin/index.ts:1753`, and as an initialiser at `:1941`), evaluating ONCE to
32
+ * (`evaluateRulesFactory` in `plugin/index.ts`), evaluating ONCE to
33
33
  * the `{ name: fn, … }` map. `keys` is the entry list, for the caller to check
34
34
  * against the source's own keys. `hostMode` / `hostBranchElided` are what the
35
35
  * macro stamps the emitted map with. `reflection` is per-grammar CST node
@@ -59,6 +59,7 @@ export type TableRuleMapOptions = {
59
59
  readonly specialise?: boolean
60
60
  /** Grammar-level ambient scan-skip, as `rules({ scanSkip }, …)` declares it. */
61
61
  readonly scanSkip?: Combinator<unknown>[]
62
+ /** @deprecated Has no effect (see `TableSettings.recovery`). Removed in the next minor release. */
62
63
  readonly recovery?: boolean
63
64
  readonly hostMode?: HostMode
64
65
  readonly trackLines?: boolean
@@ -264,7 +265,7 @@ function encodeForRun(
264
265
  ): { prog: TableProgram; fnSrcs: (string | null)[]; hostMode: HostMode; plan: ReturnType<typeof buildGrammarPlan> | undefined } | null {
265
266
  runDuplicationDiagnosticRules(ruleMap, opts.duplication)
266
267
  const encodeMap = withAmbient(ruleMap, opts)
267
- // WINNERS ARE THE NON-`lazy` ENTRIES, exactly as `codegen.ts:5639` picks them.
268
+ // WINNERS ARE THE NON-`lazy` ENTRIES, exactly as the source lowering picked them.
268
269
  // A `rules()` map stores named lazy proxies beside resolved bodies, and the plan
269
270
  // uses the winner map to give a shared subtree ONE owner; filtering differently
270
271
  // here would mint `rule:` ids the source lowering does not, so a consumer
@@ -79,8 +79,8 @@ export type TableCompileOptions = {
79
79
  readonly hostMode?: HostMode
80
80
  readonly trackLines?: boolean
81
81
  /**
82
- * ACCEPTED AND IGNORED — recovery is ALWAYS lowered (see `TableSettings.recovery`).
83
- * Kept so this stays a drop-in for `compile(g, …, { recovery: true })`.
82
+ * @deprecated ACCEPTED AND IGNORED — recovery is ALWAYS lowered (see
83
+ * `TableSettings.recovery`). Removed in the next minor release.
84
84
  */
85
85
  readonly recovery?: boolean
86
86
  /**
@@ -178,7 +178,7 @@ function compileRoot<T>(
178
178
  ): CompiledParser<T> {
179
179
  // Argument order mirrors `compile(combinator, mapFnSources?, opts?)` so this is
180
180
  // a drop-in, not a second API with a different shape.
181
- // THE SAME WALK CODEGEN USES FOR A SINGLE ROOT (`codegen.ts:5377`): no winner
181
+ // THE SAME WALK THE SOURCE LOWERING USED FOR A SINGLE ROOT: no winner
182
182
  // map, so the paths are rooted at `entry` and the ids are the ones a caller
183
183
  // switching lowerings already has. Building it differently here would produce a
184
184
  // set that is internally consistent and lines up with nothing.
@@ -807,7 +807,7 @@ export function emitAssemblySource(
807
807
  const armExpectedPlan: number[][] = []
808
808
  const maskPlan: number[] = []
809
809
 
810
- /** `codegen.ts`'s hoisted pools, same spelling: `_k<N>` / `_fx<N>` / `_fn<N>`. */
810
+ /** Hoisted pools, in the source lowering's spelling: `_k<N>` / `_fx<N>` / `_fn<N>`. */
811
811
  function hoist(kind: string, expr: string): string {
812
812
  const hit = pool.get(expr)
813
813
  if (hit !== undefined) return hit
@@ -1489,8 +1489,8 @@ return v
1489
1489
  const xf = fxRef(code[ip + 2]!)
1490
1490
  // TWO ARMS, mirroring `assemble.ts:1050`. A TOLERANT `expect()` EMBEDS
1491
1491
  // ITS ERROR IN THE TREE and not only in the flat `_errors` side-channel
1492
- // (`combinators/expect.ts:150`, codegen's `_ctx._rec.capture` at
1493
- // codegen.ts:4470) — so a tree walk finds every diagnostic and the node
1492
+ // (`combinators/expect.ts:150`, the source lowering's
1493
+ // `_ctx._rec.capture`) — so a tree walk finds every diagnostic and the node
1494
1494
  // survives incremental subtree reuse. `captureError` is the shared
1495
1495
  // function, called; the embedding is not restated here.
1496
1496
  //
@@ -2734,7 +2734,7 @@ return nd
2734
2734
  const ruleEntries: string[] = []
2735
2735
  for (const [rname, entryIp] of Object.entries(prog.rules)) {
2736
2736
  if (!served(entryIp)) continue
2737
- // `_r_<Name>` — the composition surface, in `codegen.ts`'s own spelling and
2737
+ // `_r_<Name>` — the composition surface, in the source lowering's spelling and
2738
2738
  // deliberately NOT namespaced, so a sibling calls it by name.
2739
2739
  const target = link(entryIp)
2740
2740
  const rn = `_r_${rname.replace(/[^A-Za-z0-9_$]/g, '_')}`
package/src/table/emit.ts CHANGED
@@ -15,9 +15,10 @@ export const FACTORY_ARITY_GUARD = `if(arguments.length<${EMITTED_PARAMS.length}
15
15
  /**
16
16
  * Print a program as the module a build emits.
17
17
  *
18
- * Everything here is DATA plus the author's own reducers. The recognizer is not
19
- * in this string — it is `exec.ts`, imported from the runtime, shared by every
20
- * grammar in the bundle and by every variant of each.
18
+ * Everything here is DATA plus the author's own reducers, and any assemblies
19
+ * the build pre-compiled (`a:`). The recognizer is not in this string: it is
20
+ * `tableRules` from `parseman/table`, shared by every grammar in the bundle and
21
+ * by every variant of each.
21
22
  */
22
23
 
23
24
  function jsString(s: string): string {
@@ -170,11 +171,10 @@ export function defaultAssemblyCfgs(prog: TableProgram): RunCfg[] {
170
171
  * Print the assemblies a build pre-compiled, as the `a:` field of the program
171
172
  * literal — see `TableProgram.asm`.
172
173
  *
173
- * THE FACTORY IS A REAL FUNCTION LITERAL. This is a low-level experiment, not
174
- * a normal compiler route: normal `compile()` and macro output both serialize
175
- * `a:[]` and use the compact closure assembler. If a future specialization can
176
- * meet semantic identity and the size budget, it must preserve that one public
177
- * artifact contract rather than recreate the old runtime/macro split.
174
+ * THE FACTORY IS A REAL FUNCTION LITERAL. A macro build emits one here for the
175
+ * AST, no-line-tracking option set, holding only the sites it selected within its
176
+ * budget (`compile-rule-map.ts`, `selectAssembly`); every other option set gets
177
+ * no entry and runs the closure assembler.
178
178
  *
179
179
  * A refusal is not an error. `Unemittable` names a construct the emitter does
180
180
  * not lower; that option set simply gets no entry, and `assemble.ts` runs the
@@ -186,7 +186,7 @@ function emitAssemblies(prog: TableProgram, cfgs: readonly AssemblyCfg[]): strin
186
186
  *
187
187
  * The field's PRESENCE is the compiler artifact contract. That is what switches
188
188
  * the runtime `Function` constructor off (`assemble.ts`), and it costs four
189
- * bytes. Its CONTENTS are optional experimental factories; with none, the
189
+ * bytes. Its CONTENTS are the build's selected factories; with none, the
190
190
  * artifact runs the closure engine — no eval, no
191
191
  * size growth, and the refusal readable on `Assembly.emitRefusal`.
192
192
  *
@@ -248,12 +248,11 @@ export type EmitOptions = {
248
248
  /** Name of the exported binding. */
249
249
  readonly name?: string
250
250
  /**
251
- * Optional experimental emitted factories — see `defaultAssemblyCfgs`.
251
+ * Emitted factories to pre-compile — see `defaultAssemblyCfgs`.
252
252
  *
253
- * The normal compiler and macro both emit `a:[]`: that is the canonical
254
- * compact closure artifact and it never reaches the `Function` constructor.
255
- * Supplying factories here is a low-level serialization experiment, not a
256
- * second normal compilation path; it is not used by the macro plugin.
253
+ * Without them the artifact prints `a:[]`, the compact closure artifact, which
254
+ * never reaches the `Function` constructor. The macro plugin passes one
255
+ * selective assembly here (`compile-rule-map.ts`, `replacementWithMetadata`).
257
256
  */
258
257
  readonly assemblies?: readonly AssemblyCfg[]
259
258
  /**