Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. %{
  2. #include <stdio.h>
  3. #include "y.tab.h"
  4. %}
  5.  
  6. separador ([ \t""])+
  7. letra [a-zA-Z]
  8. DIGITO [0-9]
  9. identificador {letra}({letra}|{DIGITO})*
  10. constEntera {DIGITO}({DIGITO})*
  11. %%
  12. "-"?{DIGITO}+("."{DIGITO}+)? {//printf("Encontrado TKN_NUM: %f\n",atof(yytext));yylval.real=atof(yytext);return (TKN_NUM);}
  13. {separador} {/*vacio*/}
  14. ";" {return (TKN_PTOCOMA);}
  15. "+" {return (TKN_MAS);}
  16. "-" {return (TKN_MENOS);}
  17. "*" {return (TKN_MULT);}
  18. "/" {return (TKN_DIV);}
  19. "(" {return (TKN_PA);}
  20. ")" {return (TKN_PC);}
  21. "=" {return (TKN_ASIGN);}
  22. {identificador} {yylval.cadena=strdup(yytext);return TKN_ID;}
  23. \n {retrun (NL);}
  24. . ECHO;
  25. %%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement