fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4.  
  5. %%
  6. [0-9]*[02468] { printf("Even Number: %s\n", yytext); }
  7. [0-9]*[13579] { printf("Odd Number: %s\n", yytext); }
  8. [ \t\n]+ ; // Ignore spaces, tabs, and newlines
  9. . ; // Ignore other characters
  10. %%
  11.  
  12. int main() {
  13. printf("Enter numbers:\n");
  14. yylex();
  15. return 0;
  16. }
  17.  
Success #stdin #stdout #stderr 0.02s 6980KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/97SQPj/prog:2:1: Syntax error: Operator expected
ERROR: /home/97SQPj/prog:16:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit