Skip to content

Parser accepts inputs the grammar rejects (empty sections, unknown keywords, rule/call heads, lexical edge cases) #651

Closed

Description

@adityamukho

Summary

The grammar verifier (#643) finds inputs the parser accepts and tests/grammar/grammar.pest rejects. Each is a KNOWN_DRIFT entry in src/query/datalog/parser/verifier.rs; a fix removes its entry. All are on main and v3.

Entry Example Parser today
UnterminatedString "abc (end of input) reads a string to the end
BareColon : the keyword :
LoneMinus - as a value the symbol - (pest's op_sym has no -)
EmptyQuery (query []) accepted
EmptyFind (query [:find :where [?e :a ?v]]) runs, one empty row
EmptyWhere (query [:where]) accepted
EmptyWith [:find (count ?e) :with :where …] accepted
UnknownKeyword [:find ?e :foo :where …] :foo ignored when no value follows
ResumedSection [:find ?x :any-valid-time ?y :where …] ?y joins :find; the same after :as-of N, :valid-at "…", :max-* N
CallHead (?r ?e) or (< ?e ?v) as a clause read as a rule call
AggregateHead [:find (?x ?y) :where …] an aggregate named ?x
RuleHead (rule [(foo ?x 1) …]), (rule [(?x ?y) …]) accepted; the grammar says a symbol then variable*

Not reached by the default bound (it needs 5 tokens): a function call named by a variable, [(?f ?x) ?y], parsed as a UDF named ?f.

Fix

Tighten the parser for v3.0.0 (a breaking change for inputs that are accepted today; each gets a PRS code), except where the grammar should change instead (LoneMinus may be better fixed by documenting - as a symbol). These change which input is accepted, so they stay on v3. Each fix can add a corpus file to tests/grammar/invalid/syntax/.

Activity

  1. added this to the v3.0.0 milestone on Oct 20, 2026
  2. added a commit that references this issue on Oct 20, 2026
  3. adityamukho commented on Oct 20, 2026

    @adityamukho
    CollaboratorAuthor

    Fixed on v3 by #659 (parser tightening, PRS-109..114; KNOWN_DRIFT now empty). Docs: project-minigraf/minigraf-docs#48. Ships in v3.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstabilityStability/panic issue

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions