/* Lex input */
%{
#include <stdlib.h>
#include <stdio.h>
#include "y.tab.h"
void yyerror(char* );
int varindex(char* );
%}
%%
[ \t]+ ;
(([0-9]+(\.[0-9]*)?)|([0-9]*\.[0-9]+)) {
yylval.dval = atof(yytext); return DOUBLE; }
[-+*/=] { return *yytext; }
"(" { return *yytext; }
")" { return *yytext; }
[a-z][a-z0-9]* {
yylval.ivar = varindex(yytext); return NAME; }
\n { return *yytext;}
. { char msg[25];
sprintf(msg,"%s <%s>","invalid character",yytext);
yyerror(msg); }
%%
int yywrap(void)
{
return 1;
}