fork download
  1. %{
  2. #include<stdio.h>
  3. FILE*out;
  4. %}
  5. %%
  6. "/*"([^*]|\*+[^*/])*\*+"/" {/*ignore*/}
  7. "//".* {//ignore}
  8. .|\n {fprintf(out,"%s",yytext);}
  9. %%
  10. int yywrap(){
  11. return 1;
  12. }
  13. int main(){
  14. out=fopen("out.c","w");
  15. if(out==NULL){
  16. printf("error");
  17. return 0;
  18. }
  19. printf("enter c code:\n");
  20. yylex();
  21. fclose(out);
  22. return 0;
  23. }
Success #stdin #stdout #stderr 0.02s 6868KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/Hq5UBQ/prog:23:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit