fork download
  1. %{
  2. #include <stdio.h>
  3. int v = 0;
  4. int c = 0;
  5. %}
  6.  
  7. %%
  8. [ \t\n] ;
  9.  
  10. [aA] { v++; }
  11. [eE] { v++; }
  12. [iI] { v++; }
  13. [oO] { v++; }
  14. [uU] { v++; }
  15.  
  16. [^aeiouAEIOU \t\n] { c++; }
  17. %%
  18.  
  19. int main()
  20. {
  21. printf("Enter the input string:\n");
  22. yylex();
  23. printf("Number of vowels: %d\n", v);
  24. printf("Number of consonants: %d\n", c);
  25. return 0;
  26. }
  27.  
  28. int yywrap()
  29. {
  30. return 1;
  31. }
  32.  
Success #stdin #stdout #stderr 0.03s 6844KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/4ghV2e/prog:31:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit