BrisPy rc2

The second meeting of BrisPy went well last night. Clinton Roy did a great talk on ANTLR and the python target. As I now understand it, ANTLR is a LL* parser that can generate recursive descent pure python parsers.

The wonderful thing about a recursive descent parser is that you don't have to spend 3 hours with a pad of paper to evaluate the parser by hand on sample input to track down which rule has a bug in it, it just generates a single function per grammar rule, and all the functions are easily human readable.

It sounds like the parsing side of things is a super happy easy world, but the generation side of things requires using intermediate abstract syntax trees in order to be able to do things like have multiple targets - using the same grammar file to do pretty printing, code rewriting and code generation looks like it's harder than it needs to be with ANTLR3.

Regardless, this means I won't have to handcraft many recursive descent parsers anymore. I have a few around. Exarkun got me to do an nsswitch.conf parser, Nevow has a JSON parser I wrote, I have a dice rolling irc bot that can handle (10*3d6+(1d4+1)*(1d6 drop lowest)). All of those are recursive descent parsers.

The meeting went well, there were a few non-computer scientists that were left behind, but you kind of expect that.

We'd like someone to volunteer to give a talk next month (we meet on the first Wednesday of the month) but we don't have any volunteers yet. I think something using one of the many python web technologies would be received well.

No comments: