fork download
  1. %{
  2. #include <stdio.h>
  3. int w=0, c=0, s=0, l=0;
  4. %}
  5.  
  6. %%
  7. [ \t]+ { s+=yyleng; c+=yyleng; }
  8. \n { l++; c++; }
  9. [^ \t\n]+ { w++; c+=yyleng; }
  10. . { c++; }
  11. %%
  12.  
  13. int main()
  14. {
  15. yylex();
  16. printf("Words=%d\nChars=%d\nSpaces=%d\nLines=%d\n",w,c,s,l);
  17. return 0;
  18. }
  19.  
  20. int yywrap(){ return 1; }
  21.  
Success #stdin #stdout #stderr 0.03s 6920KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/NH7cD6/prog:2:1: Syntax error: Operator expected
ERROR: /home/NH7cD6/prog:20:25: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit