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