fork download
  1. %
  2. {
  3. #include<stdio.h>
  4. int chars=0;
  5. int words=0;
  6. int space=0;
  7. int line=0;
  8. %}
  9. %%
  10. [^\n\t]+ {word++,chars+=yy leng;}
  11. \n\t " " %%
  12. void main()
  13. {yyin=fopen("data.txt","r");
  14. yylex();
  15. printf("Statistics \n");
  16. printf("Char: %d\n word: %d\n space: %d\n line %d\n",char,word,space,line);
  17. }
  18.  
Success #stdin #stdout #stderr 0.03s 6860KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/0hlB7q/prog:17:3: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit