fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4.  
  5. %%
  6. [aAeEiIoOuU] { printf("'%s' is a Vowel\n", yytext); }
  7. [b-df-hj-np-tv-zB-DF-HJ-NP-TV-Z] { printf("'%s' is a Consonant\n", yytext); }
  8. [0-9] { printf("'%s' is a Digit\n", yytext); }
  9. [^a-zA-Z0-9\n\t ] { printf("'%s' is a Special Symbol\n", yytext); }
  10. [\n] { /* Ignore newline */ }
  11. . { /* Ignore any other character */ }
  12. %%
  13.  
  14. int main()
  15. {
  16. printf("Enter a character: ");
  17. yylex();
  18. return 0;
  19. }
  20.  
  21. int yywrap()
  22. {
  23. return 1;
  24. }
  25.  
Success #stdin #stdout #stderr 0.03s 6792KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/W6Ng0q/prog:2:1: Syntax error: Operator expected
ERROR: /home/W6Ng0q/prog:24:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit