I am a new user of ANTLRworks so please bear with me. I have a small code which is as follows:
grammar modelica1;
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();} ;
I believe that this code should be displaying an AST however all I see is a parse tree. Can anyone tell me what am I doing wrong here?