Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %{
- #include <stdio.h>
- #include "y.tab.h"
- %}
- separador ([ \t""])+
- letra [a-zA-Z]
- DIGITO [0-9]
- identificador {letra}({letra}|{DIGITO})*
- constEntera {DIGITO}({DIGITO})*
- %%
- "-"?{DIGITO}+("."{DIGITO}+)? {//printf("Encontrado TKN_NUM: %f\n",atof(yytext));yylval.real=atof(yytext);return (TKN_NUM);}
- {separador} {/*vacio*/}
- ";" {return (TKN_PTOCOMA);}
- "+" {return (TKN_MAS);}
- "-" {return (TKN_MENOS);}
- "*" {return (TKN_MULT);}
- "/" {return (TKN_DIV);}
- "(" {return (TKN_PA);}
- ")" {return (TKN_PC);}
- "=" {return (TKN_ASIGN);}
- {identificador} {yylval.cadena=strdup(yytext);return TKN_ID;}
- \n {retrun (NL);}
- . ECHO;
- %%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement