|
%{
|
|
#include "calc.tab.h" // Автоматически создаётся Bison
|
|
%}
|
|
|
|
%%
|
|
[0-9]+ { yylval = atoi(yytext); return NUMBER; }
|
|
[-+*/()] { return yytext[0]; }
|
|
[ \t\n] ; // Игнорируем пробелы и переносы
|
|
. { printf("unknown: %s\n", yytext); }
|
|
%%
|
|
|
|
int yywrap() { return 1; } |