fork(1) download
  1. %{
  2. int wc = 0, cc = 0, lc = 0, bc=0;
  3. char infile[25];
  4. %}
  5. word [^ \t\n]+
  6. eol \n
  7. %%
  8. {word} {wc++; cc+=yyleng;}
  9. {eol} {lc++; cc+=yyleng;}
  10. [ ] {bc++; cc+=yyleng;}
  11. [\t] {bc+=8; cc+=yyleng;}
  12. %%
  13. int main()
  14. {
  15. printf(" Read the Input File Name \n ");
  16. scanf("%s",infile);
  17. yyin=fopen(infile,"r");
  18. yylex();
  19. fclose(yyin);
  20. printf(" No. of Chars: %d\n No. of Words: %d\n No.of Lines: %d\n No. of Blanks %d\n",cc,wc,lc,bc);
  21. return 0;
  22. }
  23.  
Success #stdin #stdout #stderr 0.02s 6760KB
stdin
Welcome to Gitam
Welcome to Kanigiri
stdout
Standard output is empty
stderr
ERROR: /home/MWkbN7/prog:22:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? ERROR: Unknown option (h for help)
   Exception: (3) program ? EOF: exit