fork download
  1. %{
  2. #include <stdio.h>
  3.  
  4. int vowels = 0;
  5. int consonants = 0;
  6. %}
  7. %%
  8. [aeiouAEIOU] { vowels++; }
  9. [b-df-hj-np-tv-zB-DF-HJ-NP-TV-Z] { consonants++; }
  10. .|\n { /* ignore other characters */ }
  11. %%
  12.  
  13. int main()
  14. {
  15. yylex();
  16. printf("Vowels : %d\n", vowels); printf("Consonants : %d\n", consonants); return 0;
  17. }
  18.  
Success #stdin #stdout #stderr 0.04s 6924KB
stdin
Hello World
stdout
Standard output is empty
stderr
ERROR: /home/aMa9Kr/prog:17:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit