[antlr-interest] [antlr-dev] Possible ANTLR 3.0/3.1 lexer generation bug

Jim Idle jimi at temporal-wave.com
Wed Aug 13 10:29:28 PDT 2008


On Wed, 2008-08-13 at 16:57 +0100, Ned Gill wrote:

> I think I've found a problem with ANTLR's lexer generation. Here's a small  
> example that shows the problem:
> 
> grammar Problem;
> 
> EOL    : '\n' ;
> BAB    : 'BAB' ;
> 
> SYMBOL : 'A'|'B' ;
> 
> line
>      : SYMBOL* EOL
>      ;
> 
> script
>      :
>      ( line
>          {
>              System.out.print($line.text);
>          }
>      )*
>      ;
> 

Rework this:

BAB : 'B'
      (   'AB')=>'AB'
        | {$type = SYMBOL; }
      )
    ;

SYMBOL : 'A';


Jim

PS: this is for the antlr-interest group rather than antlr-dev.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080813/824b3ad3/attachment.html 


More information about the antlr-interest mailing list