/* SI 413 Fall 2011 * Lab 5 * This file is ex2.ypp */ %{ #include <iostream> using namespace std; int yylex(); int yyerror(const char *p) { cerr << "Parse error!" << endl; } %} %token NUM %token OPA OPM LP RP STOP COMP %% run: res STOP run | res STOP res: exp | res COMP res exp: exp OPA term | term term: term OPM factor | factor factor: NUM | LP exp RP %% int main() { yyparse(); return 0; }