fork download
  1. %{
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. %}
  5.  
  6. %%
  7. [0-9]+ {
  8. int i = atoi(yytext);
  9. if (i % 2 == 0)
  10. printf("%d is Even\n", i);
  11. else
  12. printf("%d is Odd\n", i);
  13. }
  14. .|\n { /* Ignore other characters */ }
  15. %%
  16.  
  17. int yywrap() {
  18. return 1;
  19. }
  20.  
  21. int main() {
  22. yylex();
  23. return 0;
  24. }
  25.  
Success #stdin #stdout #stderr 0.02s 6968KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/icMzQ7/prog:24:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit