fork download
  1. %{
  2. int newline = 0, tab = 0, space = 0, ch = 0;
  3. %}
  4. %%
  5. \n {newline++;}
  6. \t {tab++;}
  7. " " {space++;}
  8. . {ch++;}
  9. %%
  10. int yywrap(){
  11. return 1;
  12. }
  13. int main(){
  14. yylex();
  15. printf("Number of newlines: %d\n", newline);
  16. printf("Number of tabs: %d\n", tab);
  17. printf("Number of spaces: %d\n", space);
  18. printf("Number of other characters: %d\n", ch);
  19. return 0;
  20. }
Success #stdin #stdout #stderr 0.03s 6760KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/Nncd2t/prog:2:4: Syntax error: Operator expected
ERROR: /home/Nncd2t/prog:20:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit