%{
#include<stdio.h>
%}
%%
else |
while |
for |
if |
do |
switch{
printf("%s is a keyword\n",yytext);
return(0);
}
[a-zA-Z_]+[a-zA-Z0-9_]*{
printf("%s is a identifier\n",yytext);
return(0);
}
[=|+|-|*|/]*{
printf("%s is a operator\n",yytext);
return(0);
}
.*{
printf("%s is not an identifier\n",yytext);
return(0);
}
%%
int main(){
printf("enter a character/word. \n");
yylex();
}
yywrap()
{
}
JXsKI2luY2x1ZGU8c3RkaW8uaD4KJX0KJSUKZWxzZSAgIHwKd2hpbGUgIHwKZm9yICAgIHwKaWYgICAgIHwKZG8gICAgIHwKc3dpdGNoeyAgICAgCglwcmludGYoIiVzIGlzIGEga2V5d29yZFxuIix5eXRleHQpOwogICAgICAgIHJldHVybigwKTsKIH0KW2EtekEtWl9dK1thLXpBLVowLTlfXSp7CiAgICAgIHByaW50ZigiJXMgaXMgYSBpZGVudGlmaWVyXG4iLHl5dGV4dCk7CiAgICAgIHJldHVybigwKTsgCn0KCls9fCt8LXwqfC9dKnsKICAgCXByaW50ZigiJXMgaXMgYSBvcGVyYXRvclxuIix5eXRleHQpOwoJcmV0dXJuKDApOwp9Ci4qewogICAgcHJpbnRmKCIlcyBpcyBub3QgYW4gaWRlbnRpZmllclxuIix5eXRleHQpOwogICAgcmV0dXJuKDApOwp9CiUlCmludCBtYWluKCl7CiAgICBwcmludGYoImVudGVyIGEgY2hhcmFjdGVyL3dvcmQuIFxuIik7CiAgICB5eWxleCgpOwp9Cnl5d3JhcCgpCnsKfQ==