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