vitessio / vitess

Vitess is a database clustering system for horizontal scaling of MySQL.
http://vitess.io
Apache License 2.0
18.58k stars 2.09k forks source link

Feature Request: Online grammar editor/tester #14052

Open mingodad opened 1 year ago

mingodad commented 1 year ago

Feature Description

Yacc/Lex runtime grammar evaluator that can provide quick feedback loop when developing/testing/debug grammars.

Use Case(s)

I've just added this project grammar to https://mingodad.github.io/parsertl-playground/playground/ (select Vitess SQL parser (be patient)(partially working) under examples then click Parse to see the parser tree for the sql in Input source).

The main repository is here https://github.com/mingodad/parsertl-playground it's a Yacc/Lex runtime grammar evaluator that can provide quick feedback loop when developing/testing/debug grammars.

It can also generate EBNF compatible with https://www.bottlecaps.de/rr/ui to generate railroad diagrams.

I hope it can help develop/debug/extend/test/document the grammar used in this project.

Any feedback is welcome !

mattlord commented 1 year ago

cc @vitessio/query-serving

mingodad commented 11 months ago

Also added another variation using %fallback (see here https://sqlite.org/src/doc/trunk/doc/lemon.html#pfallback ) for a better performance on the playground (select Vitess SQL parser with fallback (partially working) from examples).

Statistics of Vitess SQL parser (be patient)(partially working):

build master parser -> Time taken : 87ms
parse user grammar -> Time taken : 5ms
start build user grammar -> Time taken : 2ms
build user parser -> Time taken : 1481ms
dump input parser tree -> Time taken : 10ms

Statistics of Vitess SQL parser with fallback (partially working):

build master parser -> Time taken : 34ms
parse user grammar -> Time taken : 3ms
start build user grammar -> Time taken : 0ms
build user parser -> Time taken : 446ms
dump input parser tree -> Time taken : 5ms