Saturday, August 05, 2017

I Built a Query Parser Over a Weekend (Part 2)

DZone Database Zone
I Built a Query Parser Over a Weekend (Part 2)

In the previous post, I talked about what I wanted to get and how I decided to use the GOLD parser to formally define the language grammar. However, I had no intention of actually generating the parser — I wanted to write it myself. This is because I have a lot of poor experience with the results of parser generators. They generate horrible code that manages to be both unreadable and force you to go into it frequently enough to be maddening.

In particular, I haven’t been able to find anything that would be good enough as a hand-rolled parser in terms of performance, readability of the code, and the quality of errors it will generate. The latter might sound strange, but a key part of the usefulness of any language is the kind of errors that you get when you give it invalid output.

No comments:

Fun With SQL: Functions in Postgres

DZone Database Zone Fun With SQL: Functions in Postgres In our previous  Fun with SQL  post on the  Citus Data  blog, we covered w...