I'd rather not create the grammar myself. I did download a 'grammar' but it is written in a non-standard form for ANTLR or Yacc and it contains lexer statements. It would take me some time to separate the two and to introduce the correct syntax for a parser generator.
There are lots of SQL grammars suitable for parser generators, since most SQL processors use parser generators to produce their parsers. These might or might not serve your needs, depending on which SQL dialect you are interested in, and which parser generator you are planning on using.
Here are a few examples. These are all taken from official code repositories for the respective databases, which I believe avoids the "opinion-based" criterion for avoiding resource requests. There are also many non-official grammars scattered around the internet, particularly on Github, but not all of them are correct or usable.
MySQL, using Bison/C++
MySQL, from MySQL Workbench, using Antlr 4.5/C++
Sqlite3, using Lemon/C
PostgresQL, using Bison/C
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With