fork download
  1. %{
  2. #include <stdio.h>
  3. int lines = 0, words = 0, chars = 0;
  4. %}
  5.  
  6. %%
  7. \n { lines++; chars++; }
  8. [ \t]+ { chars += yyleng; }
  9. [^ \t\n]+ { words++; chars += yyleng; }
  10. %%
  11.  
  12. int main() {
  13. yylex();
  14. printf("Lines: %d\nWords: %d\nCharacters: %d\n", lines, words, chars);
  15. return 0;
  16. }
  17.  
Success #stdin #stdout #stderr 0.02s 6824KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/R68LQE/prog:16:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit