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