fork download
  1. %option noyywrap
  2. %{
  3. #include<stdio.h>
  4. %}
  5.  
  6.  
  7. %%
  8. [0-9]+ { printf("Positive"); }
  9. [A-Za-z]+ {printf("this is not a number");}
  10. .* {printf("Negative");}
  11.  
  12.  
  13. %%
  14. int main()
  15. {
  16. printf("Enter positive or negative number \n");
  17. yylex();
  18. return 0;
  19. }
Success #stdin #stdout #stderr 0.03s 6960KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/cTEX2Q/prog:19:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit