[antlr-interest] Lexing problem I cannot resolve

Carter Cheng carter_cheng at yahoo.com
Sun Aug 3 03:16:38 PDT 2008


Hi,

Yet another beginner's question. I have been having difficulties with a lexing ambiguity and I am curious how one would go about resolving it with ANTLR. The problem I am having is follows. I have a grammar with a standard C like INT FLOAT lexing rules but I also have the ellipsis ... and range .. tokens in the grammar. The difficulty I am having is with this instance string:

1..2

Which the lexer seems to like to lex as two FLOATS as oppose to as INT RANGE INT. In the language in question FLOAT FLOAT is illegal but obviously the lexer cannot know that. Is there a way to resolve this in ANTLR cleanly?

Thanks in advance,

Carter.


      


More information about the antlr-interest mailing list