fork download
  1. %{
  2. #include <stdio.h>
  3. int vow_count = 0;
  4. int const_count = 0;
  5. %}
  6.  
  7. %%
  8. [aeiouAEIOU] { vow_count++; }
  9. [bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ] { const_count++; }
  10. [ \t]
  11. \n { return 0; }
  12.  
  13. .
  14. %%
  15.  
  16. int yywrap() {
  17. return 1;
  18. }
  19.  
  20. int main() {
  21. printf("Enter the string of vowels and consonants: ");
  22. yylex();
  23. printf("\nNumber of vowels are: %d\n", vow_count);
  24. printf("Number of consonants are: %d\n", const_count);
  25. return 0;
  26. }
Success #stdin #stdout #stderr 0.04s 7008KB
stdin
Avhdnejhdh
stdout
Standard output is empty
stderr
ERROR: /home/cCdzrb/prog:2:1: Syntax error: Operator expected
ERROR: /home/cCdzrb/prog:26:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit