[antlr-interest] Multiple nondeterminism between lexer rules. (Ignore previous mail)
Bharath S
payasam79 at yahoo.com
Fri Apr 2 08:47:28 PST 2004
Hi Grp,
If I have lexer rules of this form:
-----------------
R1: A|B;
R2: C|D;
A: INT 'a';
B: REAL 'a';
C: INT 'c';
D: REAL 'd';
-----------------
Here, I have to resolve nondeterminism betwee A and C
and also between B and D. I tried to have two separate
rules to handle both but it doesnt work. I can only
handle one of them at a time but not both. Any ideas
on how ANTLR handles this?
My determinism resolving rules:
--------------------------------
R1: (INT 'c') => R2 {$setType(R2);}
| (INT 'a') => R1 {$setType(R1);}
R2: (REAL 'a') => R1 {$setType(R1);}
| (REAL 'd') => R2 {$setType(R2);}
---------------------------------------------
--- Terence Parr <parrt at cs.usfca.edu> wrote:
>
> On Mar 26, 2004, at 8:16 AM, Bharath S wrote:
>
> > Hi Ter,
> >
> > I am not running my antlr project on CVS yet. So
> its
>
> Well, something (not ANTLR and not Java) is telling
> you something about
> it being out of sync. This would explain how two
> grammar files could
> be out of date. The token types need to be the same
> across lexer and
> parser so that 32 means the same token in each, for
> example.
>
> Ter
>
> > not a revision control issue. Does token
> disconnect
> > mean that I am referring to the token wrongly in
> my
> > parser? (For eg, defining a token called INT and
> > trying to parse INTEGER, which has not been
> defined?)
> >
> > Please let me know. Another funny observation is
> that,
> > when I have my lex rule as
> >
> ---------------------------------------------------
> > IDENTIFIER options{testLiterals=true;}:
> > ('_'(LETTER|INT))|(LETTER'_'LETTER);
> >
> ---------------------------------------------------
> > it works. But if i change the (LETTER'_'LETTER) in
> the
> > above rule to just (LETTER)+, it says "expecting
> > identifier, found "abcd"; LETTER: ('0'..'9'); by
> the
> > way.
> >
> > Thanks.
> >
> > --- Terence Parr <parrt at cs.usfca.edu> wrote:
> >>
> >> On Mar 25, 2004, at 12:23 PM, Bharath S wrote:
> >>> This happened earlier but the mistake
> disappeared
> >> by
> >>> itself. Also, when i try delete the lexer so
> that
> >> i
> >>> would recreate the lexer instead of overwriting
> >> it, it
> >>> often says "OUT OF SYNC WITH THE SYSTEM".
> >>
> >> Hi. :) To start with it sounds like you have a
> >> revision control issue.
> >>
> >> Then for your grammar, you probably have a token
> >> type disconnect
> >> between lexer and parser.
> >>
> >> 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! Finance Tax Center - File online. File on
> time.
> > http://taxes.yahoo.com/filing.html
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> --
> 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