d2fn/shades-rb — pull request #15 by alindeman (2013-07-17 05:29:09+00:00)
Title: Reworks parser to use treetop

I've been wanting to play around with treetop for a while, and this seemed like
a good use case. I think it will make the grammar easier to extend for things
like where clauses and arithmetic. That said, if you hate it and want to scrap
it, no harm no foul :)

This change does make the grammar spec more strict. Parentheses are now
required in the rollup clause (i.e., "sum amount" is no longer accepted; it
must be "sum(amount)"). I couldn't figure out a clean way to differentiate stat
type name (like "sum") from identifiers (like "amount") especially when
multiple identifiers are specified (e.g., "max s1, s2"). It might be possible
with lookaheads, but that was taking me down a bit of a rabbit hole. That said,
if not using parens is desired, I can take another look.