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