%{
#include<stdio.h>
int count=0;
int letter=0;
int lcount=0;
%}
%%
[a-zA-Z0-9] {letter++;}
" " {count++;}
"\n" {lcount++; count++;
printf("\n Total words are: %d\n Total Letters are: %d\n Total Lines are:
%d\n",count,letter,lcount); lcount=0; count=0; letter=0;}
%%
int yywrap()
{
return 1;
}
int main()
{
yylex();
return 0;
}
screenshot:
No comments:
Post a Comment