This is the sequel to an earlier post where I tried to use the Clojure library Parsley to get my arms around some textual data. I was looking for a fast, cheap-and-cheerful approach that would take me from a big fat unwieldy string to a nice, regular tree-shaped data structure in 20 minutes or less.
I didn’t quite get there with Parsley, though I still think it’s a wonderful and approachable library, and it’s one that, for me, set a new standard for what kind of written artifact a programmer should have to produce in order to get a working parser. That is: it can and should be just a grammar. It should not look like this. (Maybe nothing ever should.)
As Mark Engelberg notes, “the world would be a better place if building parsers were as easy as working with regular expressions.” And he’s right; it would.
But unlike me, he actually did something about it; he wrote Instaparse. Instaparse is my new bicycle. It solved all the problems I had with Parsley (and some other problems I didn’t even know I had).