[antlr-interest] RE: updated "antlr 2 bashing list...

Pete Forman pete.forman at westerngeco.com
Fri Mar 12 01:42:05 PST 2004


At 2004-03-11 09:36 -0800, John D. Mitchell wrote:
> >>>>> "brian-l-smith" == brian-l-smith  <brian-l-smith at uiowa.edu> writes:
>[...]
>
> > * Provide a mechanism to explicitly label a rule as a start rule.
>
>++
>
>
> > * In the generated code, make all rules that aren't start rules private
> > instead of public. In general, I believe that almost all of the generated
> > methods should be private by default.
>
>Hmm... Do you really want them private or should they be protected?

My immediate thought was private.  Then I thought of an example where
protected might be needed.

If the code generated by ANTLR can be manually improved for a rule
then it might make sense to subclass and override the methods for one
or more rules.  The derived class would be used by the driving
application.

Care would need to be taken.  The optimized rule would need to be
revisited whenever the grammar was changed.  However things like
actions in other rules could be updated without worrying about the
optimized rule.

So I'd modify the OP's request to this:

     In the generated code, make all rules that aren't start rules
     private instead of public by default.  Provide an option to set
     the visibility of these non-start rules.

-- 
Pete Forman                -./\.-  Disclaimer: This post is originated
WesternGeco                  -./\.-   by myself and does not represent
pete.forman at westerngeco.com    -./\.-   opinion of Schlumberger, Baker
http://petef.port5.com           -./\.-   Hughes or their divisions.



 
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