Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %{
- #include <stdio.h>
- #define YY_DECL int yylex()
- #include "calc.tab.h"
- %}
- %option noyywrap
- %option yylineno
- ignora " "|\t|\n
- %%
- {ignora}* {;}
- [0-9]+\.[0-9]+ {yylval.fval = atof(yytext); return T_FLOAT;}
- [0-9]+ {yylval.ival = atoi(yytext); return T_INT;}
- ";" {return T_NEWLINEA;}
- "+" {return T_MAS;}
- "-" {return T_MENOS;}
- "*" {return T_POR;}
- "/" {return T_DIVIDE;}
- "(" {return T_PARENT_IZQ;}
- ")" {return T_PARENT_DER;}
- "exit" {return T_QUIT;}
- "quit" {return T_QUIT;}
- . {printf("Error\n");}
- %%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement