[antlr-interest] Lexing problem I cannot resolve

Raphael Reitzig r_reitzi at cs.uni-kl.de
Sun Aug 3 03:41:48 PDT 2008


Hi Carter!

Moving range rule above float rule should do the job. ANTLR chooses  
the first matching rule it discovers, testing bottom down.

Regards

Raphael

"Carter Cheng" <carter_cheng at yahoo.com> wrote (Sun Aug  3 12:16:38 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.
>
>
>
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: PGP Digital Signature
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080803/821adb2f/attachment.bin 


More information about the antlr-interest mailing list