fork download
  1. %{
  2. int i;
  3. %}
  4.  
  5. %%
  6.  
  7. [0-9]+ {i=atoi(yytext);
  8. if(i%2==0)
  9. printf("Even");
  10. else
  11. printf("Odd");}
  12. \n reyurn 0;
  13. %%
  14.  
  15. int yywrap(){}
  16.  
  17. int main()
  18. {
  19.  
  20. yylex();
  21. printf("Enter a valid number=");
  22. return 0;
  23. }
  24.  
Success #stdin #stdout #stderr 0.03s 6836KB
stdin
2
stdout
Standard output is empty
stderr
ERROR: /home/ZMa4D9/prog:23:2: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit