[antlr-interest] Newbie question - parsing decimal numbers

Ric Klaren klaren at cs.utwente.nl
Fri Oct 26 07:13:58 PDT 2001

On Fri, Oct 26, 2001 at 01:57:20PM -0000, david.silberberg at jhuapl.edu wrote:
>   a>3.5
>   b < 4.57
>   etc.
> I'm using the example Java.g to read NUM_INTs. 
> The token returned for the example (a>3.5) does indeed
> return 3.5. However, the token returned for the second
> example (b < 4.57) returns only 4 and ignores the '.57' .
> It seems that the white space makes a difference to the
> parser and I can't figure out why. Does any know how 
> to fix this?

Do parser and lexer have the same opinion about the values of tokens? You
can check in the generated xxxtokentype files. If not make sure to first
run the lexer through antlr then the parser. If that's not the case try
building the parser with antlr -traceParser <yourfile> then rerun the
example you now should have some trace output with token values (I hope :)
not so familiar with these things on the java side) and see from there.


    ---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 4893722  ----
 Why don't we just invite them to dinner and massacre them all when they're
  drunk? You heard the man. There's seven hundred thousand of them. Ah? ..
           So it'd have to be something simple with pasta, then.
                 From: Interesting Times by Terry Pratchet


Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

More information about the antlr-interest mailing list