Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. Integer [+|-]?[0-9]+
  2. Real {Integer}("."{Integer})?([e|E][+|-]?{Integer})?
  3. Ariop [\+ \- \* \/]
  4. Logop [\&& \|| \!]
  5. Comp_op [\< \> \<= \>= \== \!=]
  6. affectOP ["="]
  7. String [\" (.)* \"]
  8. Type "int"|"float"|"double"|"char"
  9. Keyword "if"|"else"|"for"|"break"|"continue"|"while"|"do"|"return"|"switch"
  10. Ident [_a-zA-Z]+[_A-Za-z0-9]*
  11. Comment ["/*" {String}* "*/"]
  12. Separator "("|")"|"{"|"}"|"["|"]"|","|";"
  13. %%
  14. {Integer} printf("entier: %d", yytext);
  15. {Real} printf("Real: %f", yytext);
  16. {Ariop} printf("operateur arith: %s", yytext);
  17. {Logop} printf("operateur logique: %s ", yytext);
  18. {Comp_op} printf("operateur compa: %s", yytext);
  19. {affectOP} printf("operateur affect: %s", yytext);
  20. {String} printf("String: %s", yytext);
  21. {Type} printf("Type: %s", yytext);
  22. {Keyword} printf("keyword: %s", yytext);
  23. {Ident} printf(" ident : %s", yytext);
  24. {Comment} printf("Commentaire: %s", yytext);
  25. {Separator} printf("separator: %s", yytext);
  26. %%
  27. main(){
  28. yylex();
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement