spike: evaluate 4 Rust SQL parser toolchains against SQLite 3.53.4 grammar - #3
Merged
Conversation
…ammar Implements the same SQL subset (CREATE TABLE, INSERT, SELECT, UPDATE, DELETE + shared expr grammar) in lemon-rs, pomelo, lalrpop, and pest, each verified against a shared valid/invalid SQL fixture corpus. Recommends carrying pomelo forward: closest to lemon-rs's parse.y fidelity without its vendored-C-tool maintenance burden. Full comparison in tests/spike/001_parser/comparison.md. Closes #1 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Layered Makefiles (root delegates to tests/spike/001_parser/Makefile) with a self-documenting help target, modeled on mvl-lang/mvl's Makefile. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Merged
4 tasks
This was referenced Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lemon-rs,pomelo,lalrpop,pest— each as a standalone crate undertests/spike/001_parser/.fixtures/valid.sql— 30 statements,fixtures/invalid.sql— 20 statements): all four pass 30/30 and 20/20, no panics.tests/spike/001_parser/comparison.md.Changes
Added
tests/spike/001_parser/001_lemon-rs/— Lemon grammar (parse.y),build.rscompiling vendoredlemon.cas a build-time tool against thelempar.rstemplate, hand-rolled tokenizer, minimal AST.tests/spike/001_parser/002_pomelo/—pomelo!proc-macro grammar, tokenizer, minimal AST.tests/spike/001_parser/003_lalrpop/—.lalrpopgrammar,build.rscodegen, minimal AST.tests/spike/001_parser/004_pest/—.pestPEG grammar (no separate lexer), minimal AST.tests/spike/001_parser/comparison.md— full comparison (ergonomics, error messages, performance, licensing, maintainability) with a recommendation.CLAUDE.md— project instructions (token spend policy).Results
Recommendation: carry
pomeloforward. Nearly all of lemon-rs'sparse.yfidelity, without its maintenance cost (vendored C tool, undocumented template internals, runtime panics on semantic-type mismatches). lalrpop is the strongest runner-up if compile-time diagnostics matter more thanparse.yfidelity. pest isn't recommended for the main grammar (its ordered-choice model makes reproducing SQLite's%fallback IDkeyword-as-identifier behavior structurally harder), though it could suit a narrower PEG-shaped problem later.Two cross-cutting issues surfaced that need tracking separately:
%left-mirroring comment disagree on whether chained comparisons (1 = 2 = 3) should be legal.%fallback ID(keywords double as identifiers) — out of scope for the spike, but a real differentiator going forward.Testing
cargo testpasses in all 4 variants (verified individually, not as a workspace — each is a standalone crate)Related Issues
Closes #1
🤖 Generated with Claude Code