[antlr-interest] Grammar Perplexity in v3.0 (More)
Randall R Schulz
rschulz at sonic.net
Sun Nov 12 08:54:53 PST 2006
Terence,
On Sunday 12 November 2006 08:46, Terence Parr wrote:
> On Nov 12, 2006, at 8:44 AM, Randall R Schulz wrote:
> > plainTerm
> >
> > : AtomicWord ( '(' arguments ')' ) ?
> >
> > AtomicWord
> >
> > : LowerWord
> >
> > ;
>
> These rules are a problem. AtomicWord is unreachable as both rules
> can match it's input. You will never see it in the parser.
I'm afraid I don't get it. Which "both" are you referring to? Atomic
word is a basic symbol token. It's used in several grammar productions,
including, of course, plainTerm. How does one structure their grammars
to capture this sharing? How do you stratify a mixed grammar into
non-overlapping lexical and syntactic portions?
Looking at the sample Java grammar (examples-v3/java/java.g), I seem to
see exactly these kinds of rules in the same relationship.
> Ter
Randall Schulz
More information about the antlr-interest
mailing list