[antlr-interest] Re: ambiguous grammar
mzukowski at yci.com
mzukowski at yci.com
Tue Jan 21 08:46:43 PST 2003
The easiest way to get the tree you want will be to modify your lexer to
remember that you just saw a $ and that you need to produce DOT, not FLOAT.
"Lexer states" is one approach to this (see docs). Another would be to use
semantic predicates in the lexer.
Monty
-----Original Message-----
From: beeh1973 <hastur4711 at bigfoot.com> [mailto:hastur4711 at bigfoot.com]
Sent: Monday, January 20, 2003 7:23 AM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] Re: ambiguous grammar
--- In antlr-interest at yahoogroups.com, Anakreon Mejdi <amejdi at e...>
wrote:
> component:
> DOLLAR^ FLOAT
> ;
> This should work.
> There is no DOT because in the NUMBER rule if an DIGIT is matched
the
> type is made FLOAT and the DOT is consumed.
> For the same reason there is no NUMBER Token.
>
hi,
it works but does not produce the result i need.
this would create the tree
($ .1)
instead i need the tree
($ . 1)
in fact i do not need DOT to be part of the tree. just to display the
difference. ($ 1) would suffice.
.1 is just a float literal
$.1 is a positional notation: "the first element in $"
another reply gave me the hint to check the provided Java and C
Grammars.
i will check this way.
thanks a lot,
alphonse
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list