[antlr-interest] Clarifications on grammar rules.
Terence Parr
parrt at cs.usfca.edu
Tue Apr 6 18:18:32 PDT 2004
On Apr 6, 2004, at 2:08 PM, Bharath S wrote:
> I have a rule of the form:
> ----------------------------------------
> Time: ('0'..'9')+
> ('d'{$setType(Days);} | 's'{$setType(Secs);}
> | {$setType(INT);}) ;
>
> and
> -------------------------
> protected Days: INT('d');
> protected Secs: INT('s');
> protected INT: ('0'..'9')+;
> ---------------------------
> When I try "Test: Secs|Days", I get a non-determinism
> warning and it makes sense because both rules have
> common left prefixes. However, I have no clue to how I
> can fix it. If I write a separate rule to remove
> common prefixes in "Secs" and "Days", it conflicts
> with the above rule, "Time". Am I missing something
> obvious?
Hi.
I'm not sure what you are trying to match here. What do you mean here:
> When I try "Test: Secs|Days", I get a non-determinism
Thanks,
Ter
--
Professor Comp. Sci., 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!
Cofounder, http://www.peerscope.com pure link sharing
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