[antlr-interest] a simple (not for me :)) grammar problem

Terence Parr parrt at cs.usfca.edu
Sun Jan 6 15:27:10 PST 2008


Hi. see

http://www.antlr.org/wiki/pages/viewpage.action?pageId=3604497

But generally the lexer is trying to match the 3. as a float; it  
matches greedily.
Ter

On Jan 6, 2008, at 3:23 PM, Fırat Küçük wrote:

> hi,
> the problem is related to following grammar:
>
> grammar Sample;
>
> start: (FLOAT | INTEGER) DOT IDENTIFIER;
>
> FLOAT: NUMBER DOT NUMBER;
> INTEGER: NUMBER;
> IDENTIFIER: LETTER+;
> DOT: '.';
> fragment NUMBER: DIGIT+;
> fragment LETTER: 'a' .. 'z';
> fragment DIGIT: '0' .. '9';
>
>
> let us try:
>
> 3.hello
>
> result:
> line 1:2 required (...)+ loop did not match anything at character 'h'
> line 1:3 mismatched input 'ello' expecting set null
>
>
> what should i do?
>
> -- 
> Öğr. Gör. Fırat Küçük
> ADAMYO Distance Learning
> SAKARYA University / TURKEY



More information about the antlr-interest mailing list