fork download
  1. %{
  2. #include <stdio.h>
  3.  
  4.  
  5. int yywrap(void) {
  6. return 1; // Return 1 to indicate end of input
  7. }
  8.  
  9. %}
  10.  
  11. int_const [0-9]+
  12. float_const [0-9]+\.[0-9]+
  13.  
  14. %%
  15.  
  16. {int_const} { printf("Valid Integer Constant: %s\n", yytext); }
  17. {float_const} { printf("Valid Floating-point Constant: %s\n", yytext); }
  18. .\n { /* Ignore other characters */ }
  19.  
  20. %%
  21.  
  22. int main() {
  23. yylex();
  24.     return 0;
  25. }
Success #stdin #stdout #stderr 0.03s 6916KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/meLdDD/prog:25:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit