Skip to content

docs(query): commit query-language EBNF and finalize edge traversal (S-03/S-04) - #89

Open
dotnetcadet wants to merge 2 commits into
mainfrom
feature/O01.01.01.03-query-grammar
Open

docs(query): commit query-language EBNF and finalize edge traversal (S-03/S-04)#89
dotnetcadet wants to merge 2 commits into
mainfrom
feature/O01.01.01.03-query-grammar

Conversation

@dotnetcadet

Copy link
Copy Markdown
Contributor

Summary

Delivers roadmap features S-03 [O01.01.01.03] (committed query-language EBNF) and S-04 [O01.01.01.04] (edge-traversal syntax and scoping) on one branch. Adds a normative grammar file and rewrites specification.md §5 only; §2/§3/§4/§6 are untouched.

The grammar and semantics are grounded in the real corpus (.designing/query.ograph, three worked queries) and the committed Syntax lexer/parser tests (libraries/Assimalign.OGraph.Syntax/tests/**). Where the design sketch and the executable tests diverged, the tests govern (they assert what the parser accepts and which diagnostics it raises), and every rejected sketch construct is recorded with its canonical replacement.

Changes

  • docs/grammar/ograph-query.ebnf (new, normative). Full surface syntax: entry keyword (node/n/vertex/v); .filter/.sort/.page/.project/.edge clauses; precedence-layered filter expressions (or → and → comparison → additive → multiplicative → primary); binary operator table; grouping; any/all lambda forms (braced or bare body, empty allowed); string/collection/numeric functions; sort keys with nested key sets; offset and cursor paging; nested projections, aliases, member functions, @-directives; literals (string/number/boolean/null); $var variables; # comments. A RECONCILIATION section lists every rejected sketch construct (arrow edge form, brace-less/positional clause bodies, colon aliasing, r(...) entry, @-as-variable) with rationale.
  • docs/specification.md §5 (rewritten): §5.2 references the grammar as normative; §5.3 defines the operator/function name vocabulary that §2.3.6 defers to S-03; §5.4 specifies full clause evaluation-order semantics (filter → sort → page → project); §5.5 specifies offset and cursor paging; §5.6 records the edge-traversal decision, canonical syntax, and scope-resolution rules. The §5.0 intro and §5.1 rule 3 now point at the grammar file and §5.4.

Work items resolved

Closes #20
Closes #21

Testing & verification

  • No source code changed — the deliverables are a committed grammar file and §5 spec prose; nothing to build or run.
  • Cross-checked every construct in all three .designing/query.ograph queries and every lexer/parser test against the grammar: each is either derivable or listed in RECONCILIATION.
  • Edge decision verified against the lexer ([/] are not tokens, so -[has]-> is not lexable), the passing edge tests (path form only, Assert.Empty(document.Errors)), and the GDM edge model (§2.3.3, spec-notes.md walk/trail/path).
  • Confirmed section structure (§5.1–§5.6 intact, §6.0 and appendices unchanged) and that no other lane's sections were modified.

🤖 Generated with Claude Code

dotnetcadet and others added 2 commits July 17, 2026 19:08
Add the normative query-language grammar at docs/grammar/ograph-query.ebnf
covering the full surface syntax (entry keyword, filter/sort/page/project/edge
clauses, precedence-layered filter expressions, string/collection/numeric
functions, any/all lambdas, literals, $var variables, # comments), grounded in
.designing/query.ograph and the committed Syntax lexer/parser tests, with a
RECONCILIATION section recording rejected design-sketch constructs.

Rewrite specification.md §5: reference the grammar as normative (§5.2), define
the operator/function vocabulary deferred by §2.3.6 (§5.3), specify clause
evaluation order (§5.4) and paging modes (§5.5), and finalize edge traversal
and scoping (§5.6) — the path form is canonical, the arrow form is rejected
(not lexable; unsupported by tests; the /-selector matches the GDM edge model).

Closes #20
Closes #21

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Reconcile normative prose, grammar, and executable ground truth for the
query-language grammar (issues #20/#21):

- §5.5: drop the "token MUST NOT be combined with skip" exclusion; skip is
  an optional starting offset for cursor mode, matching page-set and the
  golden CompleteParseSuccessful test.
- §5.6.2/§5.6.3 + edge-clause grammar comment: a scope always carries an
  implicit alias (entry Node Name for root, Edge Name for edge scopes) that
  can head a qualified path, so companies/addresses and providers/languages
  re-anchor as the worked examples require.
- EdgeParseSuccessTest: add Assert.Empty(document.Errors) so the edge
  path-form decision actually rests on a passing assertion.
- EBNF RECONCILIATION R6: record the trailing .v(employees).project()
  fragment so the completeness invariant holds over the whole sketch.
- EBNF Provenance: flag length() and the $ sigil as forward-looking
  normative additions not yet in FunctionType.cs / the lexer (X-01/X-02/X-03).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

[O01.01.01.04] Finalize edge-traversal syntax and scoping rules [O01.01.01.03] Specify the query-language grammar as committed EBNF

1 participant