//program for displaying words and lines
%{
int w=0,ch=0;
%}
%%
[^ \t\n.:;,]+ {w++;ch+=yyleng;}
[ \t\n.:;,]+ {ch++;}
%%
main()
{
printf("Enter the data \n");
yylex();
printf("No of words: %d \nNo of characters: %d\n",w,ch);
}
问问题
72 次