fork download
  1. %{
  2. #include<stdio.h>
  3. #include<stdlib.h>
  4. int count=0,spaces=0,tcount=0,rcount=0;
  5. %}
  6. %%
  7. \n count++;
  8. " " spaces++;
  9. \t tcount++;
  10. [^\t" "\n] rcount++;
  11. %%
  12. int main(void){
  13. yylex();
  14. printf("no of lines: %d\n",count);
  15. printf("no of spaces: %d\n",spaces);
  16. printf("no of tabs: %d\n",tcount);
  17. printf("no of rest code: %d\n",rcount);
  18. }
  19. int yywrap(){
  20. return 1;
  21. }
  22.  
  23.  
Success #stdin #stdout #stderr 0.02s 6948KB
stdin
hello I am Vanshika Sachdeva pursuing btech in cse from graphic era hill university dehradun currently in 6th sem
stdout
Standard output is empty
stderr
ERROR: /home/W2ddH1/prog:22:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit