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