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