fork download
  1. %{
  2. int vow_count = 0;
  3. int const_count = 0;
  4. %}
  5.  
  6. %%
  7. [aeiouAEIOU] { vow_count++; }
  8. [a-zA-Z] { const_count++; }
  9. %%
  10.  
  11. int yywrap() {
  12. return 1;
  13. }
  14.  
  15. int main() {
  16. printf("Enter the string of vowels and consonants: ");
  17.  
  18. yylex();
  19.  
  20. printf("Number of vowels are: %d\n", vow_count);
  21. printf("Number of consonants are: %d\n", const_count);
  22.  
  23. return 0;
  24. }
  25.  
Success #stdin #stdout #stderr 0.02s 6992KB
stdin
Hello how are you
stdout
Standard output is empty
stderr
ERROR: /home/1biEEA/prog:24:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? ERROR: Unknown option (h for help)
   Exception: (3) program ? EOF: exit