Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Integer [+|-]?[0-9]+
- Real {Integer}("."{Integer})?([e|E][+|-]?{Integer})?
- Ariop [\+ \- \* \/]
- Logop [\&& \|| \!]
- Comp_op [\< \> \<= \>= \== \!=]
- affectOP ["="]
- String [\" (.)* \"]
- Type "int"|"float"|"double"|"char"
- Keyword "if"|"else"|"for"|"break"|"continue"|"while"|"do"|"return"|"switch"
- Ident [_a-zA-Z]+[_A-Za-z0-9]*
- Comment ["/*" {String}* "*/"]
- Separator "("|")"|"{"|"}"|"["|"]"|","|";"
- %%
- {Integer} printf("entier: %d", yytext);
- {Real} printf("Real: %f", yytext);
- {Ariop} printf("operateur arith: %s", yytext);
- {Logop} printf("operateur logique: %s ", yytext);
- {Comp_op} printf("operateur compa: %s", yytext);
- {affectOP} printf("operateur affect: %s", yytext);
- {String} printf("String: %s", yytext);
- {Type} printf("Type: %s", yytext);
- {Keyword} printf("keyword: %s", yytext);
- {Ident} printf(" ident : %s", yytext);
- {Comment} printf("Commentaire: %s", yytext);
- {Separator} printf("separator: %s", yytext);
- %%
- main(){
- yylex();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement