No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

al.lex 975B

1234567891011121314151617181920212223242526272829303132333435363738
  1. %{
  2. #include "as.tab.h"
  3. #include <stdio.h>
  4. %}
  5. %%
  6. "main" { printf("tMAIN\n");}
  7. "{" { printf("tOBRACKET\n"); }
  8. "}" { printf("tCBRACKET\n"); }
  9. "(" { printf("tOBRACE\n"); }
  10. ")" { printf("tCBRACE\n"); }
  11. "const" { printf("tCONST\n"); }
  12. "int" { printf("tINT\n"); }
  13. "printf" { printf("tPRINTF\n"); } //Degeu mais à degager
  14. [0-9]+ { printf("tNB\n"); }
  15. [0-9]+e[0-9]+ { printf("tNBEXP\n"); } //Renvoyer le token tNB et pas tNBEXP
  16. "+" { printf("tADD\n"); }
  17. "-" { printf("tSUB\n"); }
  18. "*" { printf("tMUL\n"); }
  19. "/" { printf("tDIV\n"); }
  20. "=" { printf("tEQ\n"); }
  21. ";" { printf("tPV\n"); }
  22. " " { printf("tSPACE\n"); } //Ne pas les retourner à Yacc
  23. " " { printf("tTAB\n"); } //Ne pas les retourner à Yacc
  24. "," { printf("tCOMA\n"); }
  25. "\n" { printf("tRC\n") ; } //Ne pas les retourner à Yacc
  26. [a-zA-Z][a-zA-Z0-9_]* { printf("tID\n"); }
  27. . { return tERROR; }
  28. %%
  29. int yywrap(void){return 1;}