fork download
  1. %{
  2. #include<stdio.h>
  3. #include<stdlib.h>
  4. int count=0,space=0,tcount=0,rcount=0;
  5. %}
  6. %%
  7. [\n] count++;
  8. [" "] space++;
  9. \t tcount++;
  10. [^\t" "\n] rcount++;
  11. .;
  12. %%
  13. int main()
  14. {
  15. printf("enter your input: ");
  16. yylex();
  17. printf("the total no. of line are :%d\n" ,count);
  18. printf("the total no. of spaces are :%d\n" ,space);
  19. printf("the total no. of tab are :%d\n" ,tcount);
  20. printf("rest of the character are : %d\n" ,rcount);
  21. return 0;
  22. }
  23.  
  24. int yywrap(){
  25. return 1;
  26. }
Success #stdin #stdout #stderr 0.03s 6948KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/rr2BCj/prog:26:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit