%{
#include <stdio.h>
%}
%%
"void"|"int"|"float"|"double"|"char"|"if"|"else"|"while"|"for"|"do"|"break"|"continue"|"return"|"void"|"main" { printf("%s keyword\n", yytext); }
[0-9]+ { printf("%s digit\n", yytext); }
[a-zA-Z_][a-zA-Z0-9_]* { printf("%s identifier\n", yytext); }
"//"(.*)"\n" { int n = strlen(yytext); int i = 0; while(i < n - 1) {if ((yytext[i] >= 0 && yytext[i] <= 9) || (yytext[i] >= 'a' && yytext[i] <= 'z') || (yytext[i] >= 'A' && yytext[i] <= 'Z') || yytext[i] == ' ' || yytext[i] == '/') {printf("%c", yytext[i]);} else break; i++;} printf(" comment\n");}
"//"(.*) { printf("//%s comment\n", yytext+2); }
[ \t\n] ; // Skip whitespace and newline characters
. ; // Ignore any other character
%%
int main() {
yyin = stdin;
yylex();
return 0;
}
JXsKI2luY2x1ZGUgPHN0ZGlvLmg+CiV9CgolJQoKInZvaWQifCJpbnQifCJmbG9hdCJ8ImRvdWJsZSJ8ImNoYXIifCJpZiJ8ImVsc2UifCJ3aGlsZSJ8ImZvciJ8ImRvInwiYnJlYWsifCJjb250aW51ZSJ8InJldHVybiJ8InZvaWQifCJtYWluIiAgICAgICAgICAgICAgICAgICAgeyBwcmludGYoIiVzIGtleXdvcmRcbiIsIHl5dGV4dCk7IH0KWzAtOV0rICAgICAgICAgICAgICAgICAgICAgIHsgcHJpbnRmKCIlcyBkaWdpdFxuIiwgeXl0ZXh0KTsgfQpbYS16QS1aX11bYS16QS1aMC05X10qICAgICAgeyBwcmludGYoIiVzIGlkZW50aWZpZXJcbiIsIHl5dGV4dCk7IH0KIi8vIiguKikiXG4iICAgICAgICAgICAgICAgICB7IGludCBuID0gc3RybGVuKHl5dGV4dCk7IGludCBpID0gMDsgd2hpbGUoaSA8IG4gLSAxKSB7aWYgKCh5eXRleHRbaV0gPj0gMCAmJiB5eXRleHRbaV0gPD0gOSkgfHwgKHl5dGV4dFtpXSA+PSAnYScgJiYgeXl0ZXh0W2ldIDw9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