[antlr-interest] Clarifications on grammar rules.
Bharath S
payasam79 at yahoo.com
Tue Apr 6 13:57:17 PDT 2004
Hi,
Thanks to Ter for the reply; I looked at ParseTree
testing tutorial on antlr.org and it pretty much
answers my question.
I also have a small grammar related question:
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?
--- Terence Parr <parrt at cs.usfca.edu> wrote:
> On Apr 5, 2004, at 4:17 PM, Bharath S wrote:
>
> > Hi Grp,
> >
> > Can somebody provide information on how to
> automate
> > the testing of lexer/parser rules? I usually put
> my
> > test cases in a text file and feed it to my main
> > program using the direction operator. I am using
> Antlr
> > in Eclipse IDE and would like to automate testing
> > using JUnit. Can someone shed some light on this?
>
> Howdy. I will be putting some thought into this
> myself to test antlr 3
> functionality. Definitely you want to use the
> parse-tree/derivation
> stuff I put into 2.7.3 so you can see precisely how
> the tool parses
> your input.
>
> 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
>
>
> antlr-interest-unsubscribe at yahoogroups.com
>
>
>
__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway
http://promotions.yahoo.com/design_giveaway/
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