fork download
  1. %{
  2. #include<stdio.h>
  3. int pc=0, sc=0;
  4. %}
  5. %%
  6. “printf” { fprintf(yyout,”writef”); pc++;}
  7. “scanf” { fprintf(yyout,”readf”); sc++;}
  8. %%
  9. int yywrap()
  10. {
  11. return 1;
  12. }
  13. main(int argc, char *argv[])
  14. {
  15. if(argc!=2)
  16. {
  17. printf(“Usage: <./a.out> <sourcefile> <destn file>\n”);
  18. exit(0);
  19. }
  20. yyin=fopen(argv[1],”r”);
  21. yyout=fopen(argv[2],”w”);
  22. yylex();
  23. printf(“No of printf statements = %d\n No of scanf
  24. statements=%d\n”, pc, sc);
  25. }
Success #stdin #stdout #stderr 0.02s 6952KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/NckfTf/prog:25:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit