logoalt Hacker News

zellyntoday at 7:03 PM1 replyview on HN

Does SQLite not have a lemon parser generated for its SQL?

When I ported pikchr (also from the SQLite project) to Go, I first ported lemon, then the grammar, then supporting code.

I always meant to do the same for its SQL parser, but pikchr grammar is orders of magnitude simpler.


Replies

smartmictoday at 8:48 PM

Correct[0]. This was also my first thought after reading

> Unfortunately, unlike many other languages, SQLite has no formal specification describing how it should be parsed. It doesn’t expose a stable API for its parser either. In fact, quite uniquely, in its implementation it doesn’t even build a parse tree at all9! The only reasonable approach left in my opinion is to carefully extract the relevant parts of SQLite’s source code and adapt it to build the parser I wanted

Did they made a proper problem research in the first place?

[0]: https://sqlite.org/lemon.html

show 1 reply