fork download
  1. %{
  2. #include <stdio.h>
  3. int numConsonants = 0;
  4. int numVowels = 0;
  5. %}
  6.  
  7. %%
  8. [aA]|[eE]|[iI]|[oO]|[uU] { numVowels++; }
  9. [a-zA-Z] { numConsonants++; }
  10. . { /* Ignore other characters */ }
  11.  
  12. %%
  13.  
  14. int main() {
  15. yylex();
  16. printf("Total consonants: %d\n", numConsonants);
  17. printf("Total vowels: %d\n", numVowels);
  18. return 0;
  19. }
  20.  
Success #stdin #stdout #stderr 0.03s 6888KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/5NE7v0/prog:2:1: Syntax error: Operator expected
ERROR: /home/5NE7v0/prog:19:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit