fork download
  1. %{
  2. #include<stdio.h>
  3. int lc=0,wc=0,sc=0,cc=0;
  4. %}
  5.  
  6. %%
  7. [\n] {lc++; cc+=yyleng;}
  8. [ \t] {sc++; cc+=yyleng;}
  9. [^\t\n ]+ {wc++; cc+=yyleng;}
  10. %%
  11.  
  12. int main()
  13. {
  14. printf("Enter the input");
  15. yylex();
  16. printf("No of words are %d \n number of lines are %d \n number of spaces are %d",wc,lc,sc);
  17. return 0;
  18. }
  19.  
  20. int yywrap()
  21. {
  22. return 1;
  23. }
  24.  
  25.  
  26.  
Success #stdin #stdout #stderr 0.03s 7004KB
stdin
abhinand is my name
i am a boy
stdout
Standard output is empty
stderr
ERROR: /home/k1reNn/prog:25:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? % Execution Aborted
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit