/* expr-eval.bison */ %token INT %% line : expr '\n' { cout << $1; } ; expr : expr '+' term { $$ = $1 + $3; } | term ; term : term '*' fact { $$ = $1 * $3; } | fact ; fact : '(' expr ')' { $$ = $2; } | INT ;