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