fork download
  1. %{
  2. #include <stdio.h>
  3.  
  4. int line = 0;
  5. %}
  6.  
  7. %%
  8. [\n] {line++;}
  9. . {}
  10.  
  11. %%
  12.  
  13. int yywrap{}
  14. {
  15. return 1;
  16. }
  17. int main()
  18. {
  19. extern FILE *yyin,*yyout
  20. yyin=fopen("input.txt","r")//to read
  21. yyin=fopen("output.txt","w") //to write
  22. yylex();
  23. fprint(yyout,"no of lines=%d\n",line);
  24. return 0;
  25. }
  26.  
Success #stdin #stdout #stderr 0.03s 6960KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/W7dsmh/prog:2:1: Syntax error: Operator expected
ERROR: /home/W7dsmh/prog:25:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit