3 ms·
Much like with other things, recursive-descent is probably the best way to write a SQL parser as it's easy to debug, modify, and extend. There's some great hype
by userbinator 5y ago
Much like with other things, recursive-descent is probably the best way to write a SQL parser as it's easy to debug, modify, and extend. There's some great hyperlinked grammars at https://ronsavage.github.io/SQL/ https://ronsavage.github.io/SQL/ for those who want to try writing one.
Also, is it just me or does the text of this article have an almost SEO-spam-like "texture" to it? It reads very unnaturally.
- lmwnshn 5y agoOn the other hand, you're probably writing your SQL parser to parse SQL queries that are being fed into some DBMS. I found pg_query's argument convincing: "Our conclusion: The only way to correctly parse all valid SQL queries that PostgreSQL understands, now and in the future, is to use PostgreSQL itself." [0] [0] https://pganalyze.com/blog/parse-postgresql-queries-in-ruby https://pganalyze.com/blog/parse-postgresql-queries-in-ruby