%{
#include <iostream>
#include <cstdlib>
#include "calc.h"
using namespace std;

TokenSemantic yylval;
%}

%option noyywrap

%%

[0-9]+   { yylval.num = atoi(yytext); return NUM; }
[+-]  { yylval.sym = yytext[0]; return OPA; }
[*/]   { yylval.sym = yytext[0]; return OPM; }
"("      { return LP; }
")"      { return RP; }
";"      { return STOP; }
<<EOF>>  { return 0; }
[ \t\n]+ { }
.        { cerr << "Unrecognized token!" << endl; exit(1); }
%%