fork download
  1. %{
  2. #include<stdio.h>
  3. int sc=0,wc=0,lc=0,cc=0;
  4. %}
  5. %%
  6. [\n] { lc++;}
  7. [ \t] { sc++;}
  8. [^\t\n ]+ { wc++; cc+=yyleng;}
  9. %%
  10. int main(int argc ,char* argv[ ])
  11. {
  12. printf("Enter the input:\n");
  13. yylex();
  14. printf("The number of lines=%d\n The number of spaces=%d\n The number of words=%d\n The
  15. number of characters are=%d\n",lc, sc, wc, cc);
  16. }
  17. int yywrap( )
  18. {
  19. return 1;
  20. }
Success #stdin #stdout #stderr 0.03s 6880KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/VFGW4E/prog:20:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit