fork download
  1. %{
  2. #include<stdio.h>
  3. %}
  4.  
  5. %%
  6. [0-9]+ { printf("This is an Integer number\n"); }
  7.  
  8. [0-9]+"."[0-9]+ { printf("This is a Float number\n"); }
  9.  
  10. [a-zA-Z_][a-zA-Z0-9]* { printf("This is an Invalid number\n"); }
  11.  
  12. . { printf("Unknown input\n"); }
  13. %%
  14.  
  15. int main()
  16. {
  17. printf("Enter the number you want to check:\n");
  18. yylex();
  19. return 0;
  20. }
  21.  
  22. int yywrap()
  23. {
  24. return 1;
  25. }
Success #stdin #stdout #stderr 0.02s 6908KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/YKuHyg/prog:2:1: Syntax error: Operator expected
ERROR: /home/YKuHyg/prog:25:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit