%{ /* C definitions */ void yyerror(char*); #define YY_SKIP_YYWRAP #define YYSTYPE double int yywrap(void) { return 1; } #include "myparser.h" /* cf. bison's -o option */ %} /* definitions */ %option yylineno %option always-interactive %% /* rules */ [ \t]+ { /* do nothing */ } [0-9]+(\.[0-9]+)?(E[+\-]?[0-9]+)? { sscanf(yytext, "%lf", &yylval); return NUMBER; } [+\-*/()\n] { return yytext[0]; } "*+" { return FOO; } . { yyerror("Illegal character."); return '\n'; } %% /* additional C code */