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