fork download
  1. %{
  2. #include<stdio.h>
  3. int lc=0, tc=0, sc=0, cc=0;
  4. %}
  5. %%
  6. \n { lc++; }
  7. \t { tc++; }
  8. " " { sc++; }
  9. . { cc++; }
  10. %%
  11. int yywrap() {
  12. return 1;
  13. }
  14.  
  15. int main() {
  16. yylex();
  17. printf("The number of lines is %d\n", lc);
  18. printf("The number of tabs is %d\n", tc);
  19. printf("The number of spaces is %d\n", sc);
  20. printf("The number of characters is %d\n", cc);
  21. return 0;
  22. }
  23.  
Success #stdin #stdout #stderr 0.03s 6948KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/mPgNJM/prog:2:5: Syntax error: Operator expected
ERROR: /home/mPgNJM/prog:22:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit