fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4.  
  5. %%
  6.  
  7. \<[^>]+\> { printf("HTML Tag: %s\n", yytext); } // Match HTML tags
  8.  
  9. .|\n { /* Ignore other characters */ }
  10.  
  11. %%
  12.  
  13. int main(int argc, char *argv[]) {
  14. if (argc > 1) {
  15. FILE *file = fopen(argv[1], "r");
  16. if (!file) {
  17. printf("Error opening file: %s\n", argv[1]);
  18. return 1;
  19. }
  20. yyin = file;
  21. }
  22.  
  23. yylex(); // Start lexical analysis
  24.  
  25. return 0;
  26. }
  27.  
  28. int yywrap() {
  29. return 1;
  30. }
  31.  
Success #stdin #stdout #stderr 0.03s 6924KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/iD8sZy/prog:30:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit