fork download
  1. %{
  2. int vowelCount = 0;
  3. int consonantCount = 0;
  4. %}
  5.  
  6. %%
  7. [aAeEiIoOuU] { vowelCount++; }
  8. [a-zA-Z] { consonantCount++; }
  9. . ;
  10.  
  11. %%
  12.  
  13. int main() {
  14. yylex();
  15. printf("Vowels: %d\n", vowelCount);
  16. printf("Consonants: %d\n", consonantCount);
  17. return 0;
  18. }
  19.  
Success #stdin #stdout #stderr 0.03s 6824KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/vDI9uo/prog:2:4: Syntax error: Operator expected
ERROR: /home/vDI9uo/prog:18:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit