fork download
  1. %{
  2. int valid_int=0, valid_float=0;
  3. %}
  4.  
  5. %%
  6. ^[-+]?[0-9]* valid_int++;
  7. ^[-+]?[0-9]*[.][0-9]+$ valid_float++;
  8. .;
  9. %%
  10.  
  11. int main()
  12. {
  13. yylex();
  14. if(valid_int!=0) printf("Valid Integer number\n");
  15. else if(valid_float!=0) printf("Valid Float number\n");
  16. else printf("Not valid Integer/Float number\n");
  17. return 0;
  18. }
Success #stdin #stdout #stderr 0.02s 6864KB
stdin
4
2
stdout
Standard output is empty
stderr
ERROR: /home/umJjnu/prog:18:0: 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