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