Skip to content

test(grammar): satisfiability accept/reject fixtures#530

Merged
zharinov merged 3 commits into
masterfrom
gv/04-satisfiability-fixtures
Jun 28, 2026
Merged

test(grammar): satisfiability accept/reject fixtures#530
zharinov merged 3 commits into
masterfrom
gv/04-satisfiability-fixtures

Conversation

@zharinov

@zharinov zharinov commented Jun 27, 2026

Copy link
Copy Markdown
Member

Summary

  • Golden fixtures for the satisfiability checker across every construct: alternations, anchors, fields, nodes, quantifiers, definitions.
  • Each impossible pattern pins its rejection message.
  • Each valid counterpart pins its bytecode.

Why

Locks the accept/reject boundary in place so it cannot move without a visible fixture diff.

Notes

JavaScript only. Cross-language cases land with multi-language support.

zharinov added 2 commits June 27, 2026 16:44
Add a satisfiability checker that runs each node pattern against the
grammar's ordered structure and rejects patterns no concrete tree can ever
match: a child the parent never admits, an order the grammar never produces,
a strict anchor the grammar erases. The check is a Thompson-style automaton
over admissibility facts (`satisfiability/`), wired as a compile pass in
`compiler/query/stages.rs`. A step budget (`compiler/limits.rs`) and a
reference-recursion ceiling keep pathological grammars terminating. Two new
diagnostics report the outcomes: `UnsatisfiablePattern` and `QueryTooComplex`.

Emit/typegen fixtures whose authored queries were grammar-impossible are
corrected to satisfiable forms so they keep testing emission and types.
Golden fixtures pinning the satisfiability checker across every construct:
alternations, anchors, fields, nodes, quantifiers, definitions. Each
impossible pattern carries its rejection diagnostic; each valid counterpart
compiles to bytecode, so the accept/reject boundary is fixed in place.
JavaScript only; cross-language cases land with multi-language support.
@zharinov
zharinov force-pushed the gv/03-satisfiability branch from 86f12ae to 2c5e968 Compare June 27, 2026 19:44
@zharinov
zharinov force-pushed the gv/04-satisfiability-fixtures branch from 8ab241a to 735d546 Compare June 27, 2026 19:44
Base automatically changed from gv/03-satisfiability to master June 27, 2026 19:49
@zharinov
zharinov enabled auto-merge (squash) June 28, 2026 18:02
@zharinov
zharinov merged commit 8e194ba into master Jun 28, 2026
4 checks passed
@zharinov
zharinov deleted the gv/04-satisfiability-fixtures branch June 28, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant