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