From: "andrew cooke" <andrew@...>
Date: Wed, 8 Oct 2008 07:35:02 -0400 (CLT)
I was going to post this comment at http://blog.zenspider.com/2008/10/im-in-lexer-hell.html but had problems with posting. Not sure it would improve things, but it might be simpler if you left things with an ambiguous grammar, then tried some variant of packrat parsing. If the parsing was lazy (to avoid exploring all the different options) you could then have a second pass that goes through and selects the right parse (using context to resolve ambiguities). Not sure that makes sense (I've never done anything like that myself), but it might result in cleaner code. In python you might be able to implement the packrat parsing using generators - don't know if that carries across to ruby... It doesn't seem like that crazy idea, but I don't know of anyone doing it. Andrew