package Parse; action code {: static Symbol.Symbol sym(String s) { return Symbol.Symbol.symbol(s); } :}; parser code {: public Absyn.Exp parseResult; Lexer lexer; public void syntax_error(java_cup.runtime.Symbol current) { report_error("Syntax error (" + current.sym + ")", current); } ErrorMsg.ErrorMsg errorMsg; public void report_error(String message, java_cup.runtime.Symbol info) { errorMsg.error(info.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 program; start with program; /* This is a skeleton grammar file, meant to illustrate what kind of * declarations are necessary before the grammar productions. Students are * expected to replace the dummy production below with an actual grammar. */ program ::= ID ;