/* http://www.linux-france.org/article/devl/lexyacc/minimanlexyacc-4.html */ %{ /*#include "global.h"*/ #define YYSTYPE char * #include "y.tab.h" #include %} nls "\n"|"\r"|"\r\n" nums [0-9]+("."[0-9]+)? %% [ \t] { /* On ignore */ } "+" return(PLUS); "-" return(MINUS); "*" return(TIMES); "/" return(DIV); "(" return(LPAR); ")" return(RPAR); {nls} { return(0); } {nums} { yylval=strdup(yytext); return(NUM); }