%option noinput %option nounput %{ #define YYSTYPE double // data type of yacc stack #include #include "y.tab.h" int yylex(void); int yyerror(char *s); extern int lineno; %} %option noyywrap %% [ \t] { ; } // skip blanks and tabs [0-9]+\.?|[0-9]*\.[0-9]+ { sscanf(yytext, "%lf", &yylval); return NUMBER; } \n { lineno++; return '\n'; } . { return yytext[0]; } // everything else