fork download
  1. %{
  2. #include<stdio.h>
  3. int lc=0,sc=0,wc=0,cc=0;
  4. %}
  5. %%
  6. [\n]{
  7. lc++;
  8. cc+=yylen;
  9. }
  10. [\t]{
  11. sc++;
  12. cc+=yylen;
  13. }
  14. [^\t\n]+{
  15. wc++;
  16. cc+=yylen;
  17. }
  18. %%
  19. int main(int argc,char *argv[]){
  20. printf("Enter input:\n");
  21. yylen();
  22. printf("The number of lines=%d\n",lc);
  23. printf("The number of spaces=%d\n",sc);
  24. printf("The number of words=%d\n",wc);
  25. printf("The number of charcters=%d\n",cc);
  26. return 0;
  27. }
  28. int yywrap(){
  29. return 1;
  30. }
Success #stdin #stdout #stderr 0.02s 6960KB
stdin
Happy Birthday
stdout
Standard output is empty
stderr
ERROR: /home/q8S5UV/prog:30:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit