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