fork download
  1. /*Lex program to take check whether
  2. the given number is even or odd */
  3.  
  4. %{
  5. #include<stdio.h>
  6. int i;
  7. %}
  8.  
  9. %%
  10.  
  11. [0-9]+ {i=atoi(yytext);
  12. if(i%2==0)
  13. printf("Even");
  14. else
  15. printf("Odd");}
  16. %%
  17.  
  18. int yywrap(){}
  19.  
  20. int main()
  21. {
  22.  
  23. yylex();
  24. return 0;
  25. }
Success #stdin #stdout #stderr 0.03s 6936KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/jpWTca/prog:25:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit