fork download
  1. %{
  2. #include<stdio.h>
  3. int lines=0;
  4. int space=0;
  5. int tab=0;
  6. int rest=0;
  7. %}
  8. %%
  9. [\n] {lines++;}
  10. [" "] {space++;}
  11. [\t] {tab++;}
  12. [^\n\t" "] {rest++;}
  13. %%
  14. int yywrap()
  15. {
  16. return 1;
  17. }
  18. int main()
  19. {
  20. printf("Enter String : \n");
  21. yylex();
  22. printf("The numbers of Lines are : %d\n");
  23. printf("The number of Spaces are : %d\n");
  24. printf("The number of Tabs-meta Characters are : %d\n");
  25. printf("The rest of the Characters are : %d\n");
  26. return 0;
  27. }
  28.  
Success #stdin #stdout #stderr 0.02s 6812KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/Ymed84/prog:27:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit