[antlr-interest] "protected" lexer rules
Terence Parr
parrt at cs.usfca.edu
Mon Nov 8 09:17:09 PST 2004
On Nov 7, 2004, at 3:47 PM, John D. Mitchell wrote:
>
>>>>>> "Terence" == Terence Parr <parrt at cs.usfca.edu> writes:
>>>>>>> On Nov 7, 2004, at 3:17 PM, John D. Mitchell wrote:
> [...]
>
>>>> "non token"? "method"? "macro"? "internal"?
>
>>> Their only purpose for existence is to provide a single definition
>>> of a
>>> (sub-)structure of (perhaps many) token(s), right? So, they are
>>> really
>>> just "shorthand" (rules).
>
>> Yes, common substructure with optional actions; e.g., DIGIT might
>> compute
>> a value from the char.
>
>> So, "shared", "isolated", "common", "sub"?
>
> "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?
Hmm....
Ter
>
> "Common" and "shared" rules are both too generic in addition to the
> fact
> that the shorthand rule isn't necessarily commonly used or shared.
>
> At this point, "shorthand" is the best that I can come up with. That
> name
> is clear; it's not overused in Antlr, the grammar/language community,
> the
> or the general computing world; and it's descriptive of the rule's
> functional role.
>
>
>> perhaps there is a different "section"; one for regular rules and then
>> one for these shared rules?
>
> Naw, I prefer to have the helper rules next to the rule that they help.
>
> Hope this helps,
> John
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!
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