I am using ANTLRWorks 1.5 and am trying to compile and debug. Sometimes I get the following error while compiling:
[11:44:52] TODO: run and send output to this console
[11:44:56] C:\Antlr\output\tryParser.java:102: error: <identifier> expected
[11:44:56] public final tryParser.poly_return poly() throws {
[11:44:56] ^
[11:44:56] C:\Antlr\output\tryParser.java:215: error: <identifier> expected
[11:44:56] public final tryParser.term_return term() throws {
[11:44:56] ^
[11:44:56] C:\Antlr\output\tryParser.java:504: error: <identifier> expected
[11:44:56] public final tryParser.exp_return exp() throws {
[11:44:56] ^
[11:44:56] 3 errors
Can anyone tell me what does this error mean?
Sometimes it compiles without any problem but I always get the 'timeout' error in debugging.
My code is:
grammar try;
options {output=AST;}
tokens { MULT; } // imaginary token
poly: term ('+'^ term)*
;
term: INT ID -> ^(MULT["*"] INT ID)
| INT exp -> ^(MULT["*"] INT exp)
| exp
| INT
| ID
;
exp : ID '^'^ INT
;
ID : 'a'..'z'+ ;
INT : '0'..'9'+ ;
WS : (' '|'\t'|'\r'|'\n')+ {skip();} ;
It means you need to update to ANTLRWorks 1.5.2.