package Parse; action code {: static Symbol.Symbol sym(String s) { return Symbol.Symbol.symbol(s); } :}; parser code {: Lexer lexer; public void syntax_error(token current) { report_error("Syntax error (" + current.sym + ")", (Token)current); } ErrorMsg.ErrorMsg errorMsg; public void report_error(String message, Token tok) { errorMsg.error(tok.left, message); } public Grm(Lexer l, ErrorMsg.ErrorMsg err) { this(); errorMsg=err; lexer=l; } :}; scan with {: return lexer.nextToken(); :}; terminal String ID, STRING; terminal Integer INT; terminal COMMA, COLON, SEMICOLON, LPAREN, RPAREN, LBRACK, RBRACK, LBRACE, RBRACE, DOT, PLUS, MINUS, TIMES, DIVIDE, EQ, NEQ, LT, LE, GT, GE, AND, OR, ASSIGN, ARRAY, IF, THEN, ELSE, WHILE, FOR, TO, DO, LET, IN, END, OF, BREAK, NIL, FUNCTION, VAR, TYPE; non terminal Absyn.Exp program; start with program; program ::= ID {: RESULT= new Absyn.VarExp(IDleft, new Absyn.SimpleVar(IDleft,sym(ID))); :} ;