Punie commas

Allison on 2006-01-12T21:33:10

Last journal post I mentioned I was in the process of deciding which way to transform the tree structure for comma lists. Between options A, B, and C, I chose option D: modify the parser grammar. I actually implemented option B, but the result was somewhat tortured (a "code smell"), and it looked like A and C would be equally tortured. Interestingly, the way you write the parser grammar can make it easier or harder to transform the resulting parse tree. In this case, following the old yacc pattern (cexpr rule within a cexpr rule) made for a nasty transformation, while changing it to a simple repetition allowed the transformation to fall out in fairly few lines of code. I'm happy. :)