[antlr-interest] if-then-else - Grammar generates faulty parser code
John D. Mitchell
johnm-antlr at non.net
Thu Apr 22 10:00:13 PDT 2004
>>>>> "Jeff" == Jeff Vincent <JVincent at Novell.Com> writes:
[...]
> The ifFalseblock will be null if the else is omitted.
Let me suggest that that is a mistake. One of the guiding principles of
managing complexity in a translator is to reduce variability. I.e., go
ahead and create an imaginary, placeholder node such as
"EMPTY_FALSE_BLOCK".
[For the pattern minded in the audience, this is a variation of the "Null
Object" pattern and the arguments of why this is a good idea follow
directly though it all comes down to simplicity. :-)]
Hope this helps,
John
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list