%{
#include<stdio.h>
%}
%%
if|else|while|int|switch {printf("\n%s is a keyword", yytext);}
[a-zA-Z_][a-zA-Z0-9_]* {printf("\n%s is an identifier", yytext);}
[0-9]+ {printf("\n%s is a digit", yytext);}
. {printf("\nInvalid input: %s", yytext);}
%%
int main() {
printf("Enter input: ");
yylex(); // Start lexical analysis
return 0;
}
int yywrap() {
return 1;
}
JXsKICAjaW5jbHVkZTxzdGRpby5oPgolfQoKJSUKaWZ8ZWxzZXx3aGlsZXxpbnR8c3dpdGNoIHtwcmludGYoIlxuJXMgaXMgYSBrZXl3b3JkIiwgeXl0ZXh0KTt9ClthLXpBLVpfXVthLXpBLVowLTlfXSoge3ByaW50ZigiXG4lcyBpcyBhbiBpZGVudGlmaWVyIiwgeXl0ZXh0KTt9ClswLTldKyB7cHJpbnRmKCJcbiVzIGlzIGEgZGlnaXQiLCB5eXRleHQpO30KLiB7cHJpbnRmKCJcbkludmFsaWQgaW5wdXQ6ICVzIiwgeXl0ZXh0KTt9CiUlCgppbnQgbWFpbigpIHsKICAgIHByaW50ZigiRW50ZXIgaW5wdXQ6ICIpOwogICAgeXlsZXgoKTsgLy8gU3RhcnQgbGV4aWNhbCBhbmFseXNpcwogICAgcmV0dXJuIDA7Cn0KCmludCB5eXdyYXAoKSB7CiAgICByZXR1cm4gMTsKfQoK