fork download
  1. % {
  2.  
  3. # include <stdio.h>
  4. int vowels =0, consonants=0;
  5. %}
  6.  
  7. %%
  8. [aeiouAEIOU] {vowels ++;}
  9. [a-z A-Z] {consonants ++;}
  10. .;
  11.  
  12. \n;
  13. %%
  14.  
  15. int main()
  16. {
  17.  
  18. printf("enter string:");
  19. yylex();
  20.  
  21.  
  22. printf("number of vowels:%d",vowels);
  23. printf("number of consonants:%d",consonants);
  24.  
  25. return 0;
  26. }
  27. int yywrap()
  28. {
  29.  
  30. return 1;
  31.  
  32. }
Success #stdin #stdout #stderr 0.02s 5052KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/run-20100/prog:32:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit