Jim doesn't "emphasize" the benefits of doing things this way because by now we understand that this is "just how things are done."
If you relax checks like this in the grammar and place them in a post-parse analysis (tree walker for example), some of your benefits include: * Faster parsing (sometimes **much** faster) * Smaller generated code (sometimes **much** smaller) * Better error messages (**always much** better) * Everything is more maintainable Sam -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Jim Idle Sent: Wednesday, November 11, 2009 1:41 PM To: [email protected] Subject: Re: [antlr-interest] Equivalent of TOKEN{x,y} <snip> You really don't want to do things like this at the grammar level - the messages you will issue will be confusing to users "Error at 'y', expecting '}'" leaves you to guess the meaning. It is generally better to produce a CommonTree, verify it and output whatever you need. <snip> Jim List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
