cli: parse nested expression contexts iteratively
This commit is contained in:
1 parent
371329f3f0
commit
bda43d2ecb
5 files changed
+1107
-221
No files matched your search
@@ -539,4 +539,6 @@ The [generic transformation increment](source-expression-depth-audit.md#generic-
|
||||
|
||||
The [parser constructor-path increment](source-expression-depth-audit.md#parser-qualified-constructor-paths) repairs Parser.exprPath independently of generic/lowering paths. Frozen baseline probes confirm enum and struct constructor aborts at 16,384 fields; the repaired CLI returns exact E7002 through 65,536. Named-root classification, spelling, type arguments, spans, syntax errors and host OOM propagation are preserved, with one complete string allocation. Q-061 remains open for the confirmed parenthesized/mixed-call parser failures and the remaining lowering/liveness inventory; no new acceptance limit or external review is claimed.
|
||||
|
||||
The [shared expression parser increment](source-expression-depth-audit.md#shared-expression-parser-continuations) removes native re-entry through grouping, call arguments, arrays, index bounds and struct fields, sharing binary/cast/unary/postfix/primary continuations. Token/AST/spans, grammar/error priority and scoped advice remain unchanged; host OOM propagates without diagnostics or partial AST. Reused work storage and stable driver frames retain caller-arena lifetime. Block/control callbacks still recurse outside the large dispatch frame; their bounded regression probes pass, without an arbitrary-depth claim. Grouped programs check through 65,536; mixed calls format through 65,536 but now abort in lowerer `call` at 1,024. Q-061 remains open for that confirmed path and remaining control/liveness traversal; no new limit or external review is claimed.
|
||||
|
||||
Audit these paths separately with finite public/generated source inputs before claiming whole-frontend bounded native-stack processing. Prefer explicit continuations preserving existing syntax, evaluation/query order, diagnostics and OOM behavior. A new depth rejection requires a normative decision; Q-059's type-traversal resolution does not authorize one.
|
||||
@@ -425,21 +425,90 @@ No normative, source/AIR format, feature, code, bundle, acceptance-limit or
|
||||
runtime/ownership rule changes. This repairs one callback; Q-061 remains open
|
||||
and no external review covers this increment yet.
|
||||
|
||||
## Shared expression parser continuations
|
||||
|
||||
Frozen pre-repair CLI production at 371329f (`aji-before-expression-parser`)
|
||||
aborts while formatting 1,024 grouped or mixed-call levels, with empty stdout.
|
||||
`expression-parser-probes.json` and `expression-parser-*.before.fmt.stdout/
|
||||
.stderr` hold the finite inputs/results. Debug stack excerpts reread current
|
||||
source files; use `parse-before-expression-driver.zig` for baseline line text.
|
||||
|
||||
Binary precedence/RHS, casts, unary prefixes, postfix and primary entry modes
|
||||
now share explicit continuations. Groups, ordinary/typed/variant call arguments,
|
||||
array lists/repetitions, index bounds and struct field expressions suspend on
|
||||
the same worklist, including alternating forms. Grammar, comparison rejection,
|
||||
`or trap`, borrowed-place boundaries, constructor classification, trailing
|
||||
commas, type-closer splitting, spans, argument advice and error priority are
|
||||
retained. Deferred call/advice restoration is separate from the formerly
|
||||
success-only group/index restoration. Host OOM propagates without syntax
|
||||
diagnostics or partial public AST.
|
||||
|
||||
The parser reuses its work buffer across entries. Native block/control callbacks
|
||||
save a base cursor; each re-entered driver processes/unwinds only entries above
|
||||
that base. Active driver results and current work live in stable, separately
|
||||
allocated frames reused by callback depth. No AST or queued pointer targets
|
||||
relocatable work storage or a driver result. Dispatch of block/if/match callbacks
|
||||
occurs outside the large per-step frame. An initial local-frame regression at
|
||||
256 block/if levels was caught and repaired before commit. Final probes preserve
|
||||
baseline formatted bytes at 64/256 block/if levels and 64 explicit-return levels;
|
||||
explicit-return block/if forms now also format at 256, where the baseline aborts
|
||||
(`expression-parser-control-final.json` and its raw outputs). This does not prove
|
||||
arbitrary callback depth safe.
|
||||
|
||||
Scratch deinit/destroy is logical cleanup for caller arenas. Work capacity,
|
||||
driver frames, AST nodes and partial outputs retain physical caller-arena
|
||||
lifetime. Work/driver buffers are reused rather than allocated independently
|
||||
for every scalar entry. Allocation requests/failure-index outcomes need not
|
||||
match the old recursive implementation. AST output ownership and host error
|
||||
handling are unchanged.
|
||||
|
||||
The copied shallow former descent compares 4,160 expression/form/context/entry
|
||||
combinations, including complete ASTs, failures, positions, token mutations and
|
||||
advice/scope state. Type, lexical/advice, block/control and path helpers are
|
||||
shared, outside the oracle's independence. Separate public parser tests cover
|
||||
32,768 mixed levels, every constructor span, siblings, type arguments and exact
|
||||
innermost E7001 advice. Re-entry/reuse tests poison scratch bytes before reading
|
||||
returned ASTs. Every recovering direct allocation failure checks host OOM,
|
||||
empty work, restored depth/advice/call scopes and no diagnostic; persistent
|
||||
backing failures through public parse check arena cleanup and no partial AST.
|
||||
|
||||
Final probes accept checks at 65,536 grouped levels and formatting at 65,536
|
||||
mixed-call levels. Full mixed-call checking still aborts at 1,024, now in lowerer
|
||||
`call` rather than parsing (`expression-parser-final-probes.json` and
|
||||
`expression-parser-*.after.final.*.stdout/.stderr`). Permanent CLI tests separate
|
||||
full accepted grouped/scalar programs with exact AIR/fuel from syntax-only
|
||||
mixed/call inputs, and retain complete rejection records across commands.
|
||||
|
||||
Build, unit and Zig format checks pass. All 1,793 ordinary conformance cases pass
|
||||
with terminal exit 0 and exact unique corpus coverage
|
||||
(`expression-parser-conformance.jsonl` and its audit). The depth, grammar and
|
||||
independent-error CLI suites pass 737/312/234 checks. The formatter passes 6,078
|
||||
checks over 1,469 files (1,414 parsed, 55 existing syntax errors, 782 identical
|
||||
AIR outputs). Frozen old/new CLIs retain exact exit/stdout/stderr on all 1,423
|
||||
public source checks and 506 accepted lowerings
|
||||
(`expression-parser-cli-compatibility.json`). These are compiler regressions,
|
||||
not a full per-step GC pass or a model-capability measurement.
|
||||
|
||||
No normative, source/AIR format, feature, code, bundle, acceptance-limit or
|
||||
ownership/runtime rule changes. Q-061 remains open for block/control parsing,
|
||||
non-scalar lowering and the remaining liveness/read/assignment inventory.
|
||||
This increment has no external review yet.
|
||||
|
||||
## Remaining work
|
||||
|
||||
Follow-up checks accept 16 parenthesized/mixed-call levels but abort
|
||||
with empty stdout at 1,024. A qualified enum variant returns E7002 at 16
|
||||
components but aborts in Parser.exprPath at 16,384. Raw evidence is
|
||||
`generic-followup-depth-probes.json` and `generic-followup-*.stdout/.stderr`.
|
||||
Generic transformation, its path callback and Parser.exprPath above are now
|
||||
repaired; the remaining inventory includes the other observed parser failures
|
||||
and inspection-only risks:
|
||||
Generic transformation, its path callback, Parser.exprPath and the shared
|
||||
expression parser above are now repaired. The preceding follow-up records are
|
||||
historical checkpoints, not current parser failures. The remaining inventory
|
||||
includes a confirmed lowerer failure and inspection-only risks:
|
||||
|
||||
| Production path | Evidence and next scope |
|
||||
|---|---|
|
||||
| Parser `postfix`/`primary` through parenthesized `expr` | Confirmed failure at 1,024 levels; preserve grouping, precedence and spans. |
|
||||
| Parser `callArgs`, array/index/struct initializers, `ifExpr`, block/statement and match/arm expression entry | Mixed `1i64 + id(...)` calls have a confirmed parser abort at 1,024. Other callback depth behavior is unverified; include alternating forms, not only homogeneous spines. |
|
||||
| Lowerer non-scalar `expr` callbacks: calls, fields/indices/places, arrays/structs, if/match/arms and blocks/statements | Native re-entry remains outside the repaired scalar driver; deep behavior unverified, including alternating scalar/non-scalar expressions. |
|
||||
| Parser `ifExpr`, block/statement and match/arm expression entry | Native callback re-entry remains. Bounded block/if regression probes above pass; arbitrary and alternating control/statement depth is unverified. |
|
||||
| Lowerer non-scalar `expr` callbacks: calls, fields/indices/places, arrays/structs, if/match/arms and blocks/statements | Mixed scalar/call source now has a confirmed native abort in `call` at 1,024 after parsing succeeds. Other callback depth remains unverified; include alternating scalar/non-scalar expressions. |
|
||||
| Lowerer use-after-region/liveness and assignment scans (`After`, first-use/read scans, `blockAssigns`/`stmtAssigns`/`exprAssigns`, match/select helpers) | Recursive AST walks inspected; audit their callers and finite deep inputs separately. |
|
||||
|
||||
The formatter's expression-marking traversal already uses a worklist, as
|
||||
|
||||
@@ -613,3 +613,26 @@ No normative/bundle/feature/code/acceptance-limit or runtime/ownership rule
|
||||
changes. Parenthesized and mixed-call parsing failures, remaining expression/
|
||||
statement walks, Q-060 validation and Phase 6 exit gates remain open. This
|
||||
increment has no external review yet.
|
||||
|
||||
## Source shared expression parsing (2026-10-10)
|
||||
|
||||
The [Q-061 parser increment](../design/source-expression-depth-audit.md#shared-expression-parser-continuations)
|
||||
shares explicit precedence/cast/unary/postfix/primary continuations with groups,
|
||||
call arguments, arrays, indices and struct fields. Grammar, spans, token/error
|
||||
order and call/advice scopes are preserved. Reused work storage and stable
|
||||
driver frames support native callback re-entry without retaining AST pointers
|
||||
into scratch; host OOM remains separate from source diagnostics. No normative/
|
||||
bundle/feature/code/acceptance-limit or ownership/runtime rule changes.
|
||||
|
||||
Independent shallow comparisons (4,160), 32,768 mixed levels with exact spans
|
||||
and leaf E7001 advice, poisoned scratch/re-entry and recovering/persistent OOM
|
||||
tests pass. Build/units/format checks, all 1,793 ordinary conformance cases with exact
|
||||
coverage and 737/312/234 depth/grammar/independent-error CLI checks pass. The
|
||||
formatter passes 6,078 checks; frozen old/new public checks/lowerings remain
|
||||
exact (1,423/506). Grouped source checks reach 65,536; mixed-call formatting reaches
|
||||
65,536. Block/if regression probes preserve accepted baseline output, including
|
||||
256 levels; explicit-return forms improve from baseline aborts to formatting
|
||||
at 256. These are bounded probes, not a whole-parser depth guarantee. Full
|
||||
mixed-call checking now confirms a lowerer `call` abort at 1,024; control/block
|
||||
parsing, remaining expression/statement/liveness walks, Q-060 validation and
|
||||
Phase 6 exit gates remain open. No external review covers this increment yet.
|
||||
Reference in new issue
Block a user