Skip to content

feat: V2 phase 1 — SELECT-core parser + AST + diagnostics #61

Description

@iheitlager

Refs: 002/Req-2, 002/Req-3, 002/Req-4
Part of epic #56, phase 1 (0.5.0). Gated by spike 006 (#57) — approach (sliced grammar vs recursive descent) comes from its verdict. Spec: 002-parser Reqs 2-4 flip planned→active.

Scope

SELECT-core slice (~40 productions):

  • SELECT [DISTINCT] result-columns FROM table [WHERE expr] [ORDER BY terms] [LIMIT n [OFFSET m]]
  • Result columns: *, expr, expr AS alias
  • Expression grammar: literals, column refs (bare + table.col), unary/binary ops with SQLite precedence, IS [NOT] NULL, [NOT] BETWEEN, [NOT] IN (value-list), [NOT] LIKE [ESCAPE], CASE, CAST, function calls, parens, parameters
  • AST: typed nodes, spans everywhere, grouping preserved (002/Req-3)
  • Three-way outcome (from spike 006): accept / reject-unsupported ("JOIN not yet supported", pointing at the token) / reject-invalid (syntax error with location) — 002/Req-4 diagnostics
  • Roundtrip: parse → print → parse gives identical AST

Oracle parity

Accept/reject parity on the #2 corpus slice: everything sqlite3 accepts in-subset we accept; everything it rejects we reject (unsupported-but-valid is our third state, verified against oracle accepting it).

Acceptance criteria

  • Corpus slice: 100% three-way outcome parity
  • Spec 002 Reqs 2-4 scenarios green, per-scenario Tests links
  • DDL-reader independence regression (002/Req-5) still green
  • Fuzz target on the parser; mvl-limit clean; no dead links

🤖 Generated with Claude Code

Complexity

Size: Large. This is the real (non-spike) phase-1 parser: pomelo grammar/tokenizer for the SELECT-core slice (~40 productions), typed AST with spans, the accept/unsupported/syntax-error boundary from spike 006, roundtrip printing, oracle-parity corpus run, spec 002 Req 2-4 scenario links, and a fuzz target — substantially more surface than spike 006's throwaway crate.

Token budget: 1.2M (main-loop + any delegated agents/workflows combined).


🤖 Generated with Claude Code

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions