DevJourney · code I wrote while learning
main.l
516 B%{
#include "y.tab.h"
#include <stdlib.h>
%}
%%
[0-9]+(\.[0-9]+)? {
yylval = atof(yytext);
return NUMBER;
}
[ \t] ;
\n return '\n';
"+" return '+';
"-" return '-';
"*" return '*';
"/" return '/';
"(" return '(';
")" return ')';
. return yytext[0];
%%
int yywrap()
{
return 1;
}