%{
#include<stdio.h>
%}
%%
if |
else |
printf{printf("\n %s is a keyword", yytext)}
[0-9]+ printf{printf("\n %s is a number", yytext)}
[a-zA-Z]+ printf{printf("\n %s is a word", yytext)}
.|\n{ECHO;}
%%
int main(){
printf("enter the string");
yylex();
}
int yywrap(){
return 1;
} lex(T, R).
lex([X | T], [X | R]) :- lex(T, R).
JXsKICAjaW5jbHVkZTxzdGRpby5oPgolfQoKJSUKaWYgfAplbHNlIHwKcHJpbnRme3ByaW50ZigiXG4gJXMgaXMgYSBrZXl3b3JkIiwgeXl0ZXh0KX0KWzAtOV0rIHByaW50ZntwcmludGYoIlxuICVzIGlzIGEgbnVtYmVyIiwgeXl0ZXh0KX0KW2EtekEtWl0rIHByaW50ZntwcmludGYoIlxuICVzIGlzIGEgd29yZCIsIHl5dGV4dCl9Ci58XG57RUNITzt9CiUlCgppbnQgbWFpbigpewogIHByaW50ZigiZW50ZXIgdGhlIHN0cmluZyIpOwogIHl5bGV4KCk7CiAgCn0KaW50IHl5d3JhcCgpewogIHJldHVybiAxOwp9IGxleChULCBSKS4KbGV4KFtYIHwgVF0sIFtYIHwgUl0pIDotIGxleChULCBSKS4K