fork download
  1. %{
  2. #include <stdio.h>
  3. int sp=0;
  4. int lines=0;
  5. int ch=0;
  6. int tabs=0;
  7. }%
  8.  
  9. %%
  10. " " {sp++;}
  11. \t {tabs++;}
  12. \n {lines++;}
  13. . {ch++;}
  14. %%
  15.  
  16. int main()
  17. {
  18. printf("enter the input");
  19. yylex();
  20. printf("spaces=%d\ntabs=%d\nlines=%d\ncharacters=%d\n",sp,tabs,lines,ch);
  21. return 0;
  22. }
  23.  
  24. int yywrap()
  25. {
  26. return 1;
  27. }
Success #stdin #stdout #stderr 0.04s 6824KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/O7q8Yw/prog:2:1: Syntax error: Operator expected
ERROR: /home/O7q8Yw/prog:27:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit