fork download
  1. %{
  2. #include<stdio.h>
  3. int lc=0,sc=0,tc=0,ch=0,wc=0;
  4. %}
  5.  
  6. %%
  7. [\n] { lc++; ch+=yyleng;}
  8. [ \t] { sc++; ch+=yyleng;}
  9. [^\t] { tc++; ch+=yyleng;}
  10. [^\t\n ]+ { wc++; ch+=yyleng;}
  11. %%
  12.  
  13. int yywrap(){ return 1; }
  14. int main(){
  15. printf("Enter the Sentence : ");
  16. yylex();
  17. printf("Number of lines : %d\n",lc);
  18. printf("Number of spaces : %d\n",sc);
  19. printf("Number of tabs, words, charc : %d , %d , %d\n",tc,wc,ch);
  20. return 0;
  21. }
Success #stdin #stdout #stderr 0.02s 6980KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/M55yib/prog:21:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit