%{
#include<stdio.h>
int vow,con;
%}
%%
"auto"|"break"|"case"|"char"|"const"|"continue"|"default"|"do"|"double"|"else"|"enum"|"extern" { printf("Keyword: %s\n",yytext); }
"float"|"for"|"goto"|"if"|"int"|"long"|"register"|"return"|"short"|"signed"|"sizeof"|"static"|"struct" { printf("Keyword: %s\n",yytext); }
"switch"|"typedef"|"union"|"unsigned"|"void"|"volatile"|"while" { printf("Keyword: %s\n",yytext); }
[0-9]+ { printf
("
Number: %s\n",yytext); } [+*/=><%#] { printf("Operator: %s\n",yytext); }
[{(:"?/,.\)}&|$#;] { printf("Special Characters: %s\n",yytext); }
[A-Za-z_][A-Za-z0-9_]* { printf("Identifier: %s\n",yytext); }
[ \t\n]+ //Ignore whitespace
. { printf("Unknown Character: %s\n",yytext); }
%%
int yywrap()
{
return 1;
}
void main(int argc, char* argv[1])
{
yyin = fopen(argv[1],"r");
yylex();
}
JXsKI2luY2x1ZGU8c3RkaW8uaD4KaW50IHZvdyxjb247CiV9CgolJQoiYXV0byJ8ImJyZWFrInwiY2FzZSJ8ImNoYXIifCJjb25zdCJ8ImNvbnRpbnVlInwiZGVmYXVsdCJ8ImRvInwiZG91YmxlInwiZWxzZSJ8ImVudW0ifCJleHRlcm4iIHsgcHJpbnRmKCJLZXl3b3JkOiAlc1xuIix5eXRleHQpOyB9CiJmbG9hdCJ8ImZvciJ8ImdvdG8ifCJpZiJ8ImludCJ8ImxvbmcifCJyZWdpc3RlciJ8InJldHVybiJ8InNob3J0Inwic2lnbmVkInwic2l6ZW9mInwic3RhdGljInwic3RydWN0IiB7IHByaW50ZigiS2V5d29yZDogJXNcbiIseXl0ZXh0KTsgfQoic3dpdGNoInwidHlwZWRlZiJ8InVuaW9uInwidW5zaWduZWQifCJ2b2lkInwidm9sYXRpbGUifCJ3aGlsZSIgeyBwcmludGYoIktleXdvcmQ6ICVzXG4iLHl5dGV4dCk7IH0KWzAtOV0rICAgeyBwcmludGYoIk51bWJlcjogJXNcbiIseXl0ZXh0KT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