identify a sentence and return the length of each word.
%{ int a=0; int a2; %} %% " " {a++;} [a-zA-Z]+ {printf("word: %s \t\t letters in the word: %d\n",yytext,yyleng);} %% main() { yylex(); a=a+1; printf("Sentence lenght: %d",a); }
At present you can find compiler design programs and further I will be uploading general programs of C, C++ and Java.