digit [0-9]
%{
int cons=0;
%}
%%
{digit}+ { cons++; printf("%s is a constant\n", yytext); }
.|\n { }
%%
int yywrap(void) {
return 1; }
int main(void)
{
FILE *f;
char file[10];
printf("Enter File Name : ");
scanf("%s",file);
f = fopen(file,"r");
yyin = f;
yylex();
printf
("
Number of Constants
: %d\n", cons); fclose(yyin);
}
ZGlnaXQgWzAtOV0gCiV7IAppbnQgY29ucz0wOyAKJX0gCiUlIAp7ZGlnaXR9KyB7IGNvbnMrKzsgcHJpbnRmKCIlcyBpcyBhIGNvbnN0YW50XG4iLCB5eXRleHQpOyAgfSAKLnxcbiB7IH0gCiUlIAppbnQgeXl3cmFwKHZvaWQpIHsgCnJldHVybiAxOyB9IAppbnQgbWFpbih2b2lkKSAKeyAKRklMRSAqZjsgCmNoYXIgZmlsZVsxMF07IApwcmludGYoIkVudGVyIEZpbGUgTmFtZSA6ICIpOyAKc2NhbmYoIiVzIixmaWxlKTsgCmYgPSBmb3BlbihmaWxlLCJyIik7IAp5eWluID0gZjsgCnl5bGV4KCk7IApwcmludGYoIk51bWJlciBvZiBDb25zdGFudHMgOiAlZFxuIiwgY29ucyk7IApmY2xvc2UoeXlpbik7ICAgCn0g