%{ /* * exp.l is the flex specification for * exp.y++. The exp.tab.h++ will be generated * bison (yacc) compiler. Compile as * $ flex exp.l * output: lex.yy.c */ #include #include #include "expLL.tab.h" /* Generated by bison */ /* Copied verbatim in lex.yy.c */ %} %option noyywrap DELIM ([ \t]) WHITESPACES ({DELIM}+) NATNUM ([0-9]+) FLOAT (([0-9]*\.[0-9]+)|([0-9]+\.[0-9]*)) %% {WHITESPACES} { ; } {NATNUM} { yylval.integer = atoi(yytext) ; return IC ; } {FLOAT} { yylval.real = (double)atof(yytext) ; return FC ; } "+" { return (int)'+' ; } "-" { return (int)'-' ; } "*" { return (int)'*' ;} "/" { return (int)'/' ;} "\n" { return (int)'\n';} "(" { return (int)'(';} ")" { return (int)')';} %% /* No C code */