fork download
  1. %{
  2. #include<stdio.h>
  3. int v=0;
  4. int c=0;
  5. %}
  6. %%
  7. [\t \n] ;
  8. [aeiouAEIOU] {v++;}
  9. [^aeiouAEIOU] {c++;}
  10. %%
  11. int yywrap()
  12. {
  13. return 1;
  14. }
  15. int main()
  16. {
  17. printf("Enter the string:");
  18. yylex();
  19. printf("\nNo of vowels=%d\nNo of consonants=%d",v,c);
  20. }
  21.  
  22.  
Success #stdin #stdout #stderr 0.02s 6852KB
stdin
hello
stdout
Standard output is empty
stderr
ERROR: /home/XxJr2P/prog:21:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? Options:
+:                  spy        -:              no spy
/c|e|r|f|u|a goal:  find       .:              repeat find
a:                  abort      A:              alternatives
b:                  break      c (ret, space): creep
[depth] d:          depth      e:              exit
f:                  fail       [ndepth] g:     goals (backtrace)
h (?):              help       i:              ignore
l:                  leap       L:              listing
n:                  no debug   p:              print
r:                  retry      s:              skip
u:                  up         w:              write
m:                  exception details
C:                  toggle show context
   Exception: (3) program ? EOF: exit