/* file name : calc2.l */ /* lexer for arithmetic expression calculator. */ /* See bison specification calc2.y */ %{ #define YYSTYPE double #include "calc2.tab.h" %} DIGIT [0-9] %% {DIGIT}+("."{DIGIT}+)? { yylval = atof(yytext); return NUMBER; } [ \t] /* ignore whitespace */ <> yyterminate(); /* signal end of dialogue */ \n return yytext[0]; . return yytext[0]; %%