fork download
  1. %{
  2. #include<stdio.h>
  3. #include<stdlib.h>
  4.  
  5. FILE*yyin;
  6. %}
  7.  
  8. digit [0-9]
  9. number {digit}+(\.{digit}*)?
  10. %%
  11.  
  12. {number} {printf("%s\n",yytext);}
  13. [\t\n]+ ;
  14. . ;
  15. %%
  16.  
  17. int main(int argc, char*argv[])
  18. {
  19. if(argc<2)
  20. {
  21. printf("Usage:%<file>\n",argv[0]);
  22. return 1;
  23. }
  24. yyin = fopen(argv[1],"r");
  25. if(!yyin)
  26. {
  27. perror("file not open");
  28. return 1;
  29. }
  30. yylex();
  31. fclose(yyin);
  32. return 0;
  33. }
Success #stdin #stdout #stderr 0.02s 6908KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/BABghk/prog:2:2: Syntax error: Operator expected
ERROR: /home/BABghk/prog:33:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit