fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4.  
  5. %%
  6. [0-9]+ { printf("\nIt is an integer\n"); }
  7. [0-9]+\.[0-9]+ { printf("\nIt is a decimal\n"); }
  8. [a-zA-Z]+ { printf("\nIt is an alphabet\n"); }
  9. [a-zA-Z0-9]+ { printf("\nIt is alphanumeric\n"); }
  10. . { printf("Wrong option\n"); }
  11. %%
  12.  
  13. int main() {
  14. printf("Enter the input: ");
  15. yylex(); // Correct spelling
  16. return 0;
  17. }
  18.  
  19. int yywrap() {
  20. return 1;
  21. }
  22.  
Success #stdin #stdout #stderr 0.04s 6948KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/CJQHCe/prog:2:3: Syntax error: Operator expected
ERROR: /home/CJQHCe/prog:21:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit