fork download
  1. %{
  2. #include <stdio.h>
  3.  
  4. int vowel_count = 0;
  5. int consonant_count = 0;
  6. %}
  7.  
  8. %%
  9. [aAeEiIoOuU] { vowel_count++; }
  10. [a-zA-Z] { consonant_count++; }
  11. . ;
  12. %%
  13.  
  14. int main() {
  15. yylex();
  16. printf("Number of vowels: %d\n", vowel_count);
  17. printf("Number of consonants: %d\n", consonant_count);
  18. return 0;
  19. }
  20.  
Success #stdin #stdout #stderr 0.02s 6864KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/nNzL7z/prog:2:1: Syntax error: Operator expected
ERROR: /home/nNzL7z/prog:19:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit