[antlr-interest] eclipse plugin unexpected token, grammar.

jabon elekis at gmail.com
Sun Mar 30 01:19:55 PDT 2008


hi all

I try to use the antlr plugin but I have a error.

I ve create a file named yaflplug.g and inside I have a simple grammar 
(see below).

In command line, no problem but in the antlr éditor. I have the 
following error.
unexpected error : grammar.

do you have any idea?? thanks

a++

grammar yaflplug;
tokens {
    PLUS     = '+' ;
    MINUS    = '-' ;
    MULT    = '*' ;
    DIV    = '/' ;
}
/*------------------------------------------------------------------
 * PARSER RULES
 *------------------------------------------------------------------*/

expr    : term ( ( PLUS | MINUS )  term )* ;

term    : factor ( ( MULT | DIV ) factor )* ;

factor    : NUMBER ;


/*------------------------------------------------------------------
 * LEXER RULES
 *------------------------------------------------------------------*/

NUMBER    : (DIGIT)+ ;

WHITESPACE : ( '\t' | ' ' | '\r' | '\n'| '\u000C' )+     { $channel = 
HIDDEN; } ;

fragment DIGIT    : '0'..'9' ;



More information about the antlr-interest mailing list