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