/* calculator.lex Jeff Ondich, 5/30/10 Bison example, based on several found on-line, especially http://www.cs.ucr.edu/~lgao/teaching/calc/calc.y by Lan Gao. This lex/flex file tokenizes the input for the calculator. */ %{ #include "calculator.h" #include "tok.h" %} digit [0-9] integer {digit}+ %% {integer} { yylval.value = atoi(yytext); return INTEGER; } "+" { yylval.value = 0; return PLUS; } "*" { yylval.value = 0; return MULT; } [ \t]* {} [\n] {} . { yyerror("Trouble in tokenizer."); }