fork download
  1. %{
  2. #include<stdio.h>
  3. int w=0,ch=0,s=0,l=0;
  4. %}
  5. word[^ \t\n]+
  6. %%
  7. {word} {w++;ch+=yyleng;}
  8. " " {s++;}
  9. \n {l++;}
  10. %%
  11. int main()
  12. {
  13. yyin=fopen("app.txt",r);
  14. yylex();
  15. printf("\n the no of words is %d",w);
  16. printf("\n the no of words is %d",ch);
  17. printf("\n the no of words is %d",s);
  18. printf("\n the no of words is %d",l);
  19. fclose(yyin);
  20. fclose(yyout);
  21.  
  22. }
Success #stdin #stdout #stderr 0.02s 6984KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/36BaWc/prog:22:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit