[antlr-interest] "protected" lexer rules

John D. Mitchell johnm-antlr at non.net
Mon Nov 8 09:21:12 PST 2004


>>>>> "Terence" == Terence Parr <parrt at cs.usfca.edu> writes:
>>>>>> On Nov 7, 2004, at 3:47 PM, John D. Mitchell writes:
[...]

>> "Sub" rule is very bad because it's already got a meaning.

> Yeah, it's an ambiguous term already, true.  "subrule" I started using a
> decade ago to mean EBNF stuff; i.e., an anonymous embedded rule.
> However, it's also convenient to use the term for a rule invoked by
> another rule.  Heh, wait, did I just convince myself that subrule is not
> a bad keyword since it's similar enough to one and identical to the
> other?  EBNF should really be embedded rule, but regardless, most people
> will get it if I say:

> INT : (DIGIT)+ ;

> subrule DIGIT : '0'..'9' ;

> The problem with protected (equally private) is that the intended meaning
> is a side effect of the main meaning of the word.  The above snippet
> would be clear to anybody just casually looking at a new 3.0 grammar,
> right?

Eek! No!  Then it would be impossible/confusing/etc., in conversation, to
distinguish between (normal) rules that are used by other rules and
"helper" rules that are used by other rules.

Take care,
	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