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