fork download
  1. %{
  2. #include<stdio.h>
  3. #include<ctype.h>
  4. int vowel_count = 0, conso_count = 0;
  5.  
  6. %}
  7.  
  8. %%
  9.  
  10. [aeiouAEIOU] { vowel_count++; }
  11. [b-df-hj-np-tv-zB-DF-HJ-NP-TV-Z] { conso_count++; }
  12.  
  13. %%
  14.  
  15. int main() {
  16. printf("Enter a string: ");
  17. yylex();
  18. printf("Vowels: %d\n", vowel_count);
  19. printf("Consonants: %d\n", conso_count );
  20. return 0;
  21. }
  22. int yywrap(void) {
  23. return 1;
  24. }
  25.  
Success #stdin #stdout #stderr 0.04s 6948KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/2n25Sy/prog:24:5: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit