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