/* SI 413 Fall 2021
 * Lab 4
 * YOUR NAMES HERE!
 * Flex file specifying the calculator program scanner
 */
%{
#include "calc.tab.hpp"
#include <cstdlib> // for atoi
%}

/* This tells flex to quit when it reaches EOF */
%option noyywrap

%%

[0-9]+    { yylval.val = 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]+  { }
.         { errout << "Unrecognized token starting with " << yytext[0] << endl; exit(1); }
%%