%{ #include #include "util.h" #include "errormsg.h" int yylex(void); /* function prototype */ void yyerror(char *s) { EM_error(EM_tokPos, "%s", s); } %} %union { int pos; int ival; string sval; } %token ID STRING %token INT %token 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 %start program %% /* This is a skeleton grammar file, meant to illustrate what kind of * declarations are necessary above the %% mark. Students are expected * to replace the two dummy productions below with an actual grammar. */ program: exp exp: ID