fork download
  1. %{
  2. int line_count = 0;
  3. int char_count = 0;
  4. %}
  5.  
  6. %%
  7.  
  8. \n { line_count++; }
  9. . { char_count++; }
  10.  
  11. %%
  12.  
  13. int main() {
  14. yylex();
  15. printf("Total lines: %d\n", line_count);
  16. printf("Total characters: %d\n", char_count);
  17. return 0;
  18. }
  19.  
Success #stdin #stdout #stderr 0.03s 6856KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/ldhkzM/prog:2:4: Syntax error: Operator expected
ERROR: /home/ldhkzM/prog:18:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit