[antlr-interest] a simple (not for me :)) grammar problem
r.mark.volkmann at gmail.com
Sun Jan 6 15:28:22 PST 2008
On Jan 6, 2008 5:23 PM, Fırat Küçük <firatkucuk at gmail.com> wrote:
> 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:
> line 1:2 required (...)+ loop did not match anything at character 'h'
> line 1:3 mismatched input 'ello' expecting set null
I think it's trying to match a FLOAT which requires a number after the
DOT. It should work if you change the start rule to this.
start: INTEGER DOT IDENTIFIER;
Do you really need to be able to parse something like this?
R. Mark Volkmann
Object Computing, Inc.
More information about the antlr-interest