fork download
  1. %{
  2. #include<stdio.h>
  3. int c = 0; // character count
  4. int w = 0; // word count
  5. int s = 0; // space count
  6. int l = 0; // line count
  7. %}
  8. %%
  9. " " { s++; w++; }
  10. [\n] { l++; w++; }
  11. [\t\n] { w++; }
  12. [^\t\n] { c++; }
  13. %%
  14. int yywrap()
  15. {return 1;
  16. }
  17. int main()
  18. {yyin = fopen("Info.txt", "r");
  19. yylex();
  20. printf("Characters = %d\nWords = %d\nSpaces = %d\nLines= %d\n", c, w, s, l);
  21.  
  22. }
  23.  
Success #stdin #stdout #stderr 0.02s 6856KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/D8lOZY/prog:22:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit