fork download
  1.  
  2. /* Lex program to check whether input is digit or not. */
  3. %{
  4. #include<stdio.h>
  5. #include<stdlib.h>
  6. %}
  7. /* Rule Section */
  8. %%
  9.  
  10. ^[0-9]* printf("digit");
  11.  
  12. ^[^0-9]|[0-9]*[a-zA-Z] printf("not a digit");
  13. . ;
  14. %%
  15.  
  16. int main()
  17. {
  18.  
  19. // The function that starts the analysis
  20.  
  21. yylex();
  22.  
  23. return 0;
  24. }
Success #stdin #stdout #stderr 0.02s 6896KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/fTG5Sa/prog:4:1: Syntax error: Operator expected
ERROR: /home/fTG5Sa/prog:24:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit