/* count white spaces [coded by Arul John] */ %{ #include int length = 0; %} %option noyywrap IDENTIFIER [azAZ][azAZ]* %% \n length++; "*" printf("star\n"); "+" printf("plus\n"); IDENTIFIER printf("string length is %i", yyleng); %% main() { yylex(); printf("number of white spaces is %i\n", length); }