fork download
  1. %{
  2. #include<stdio.h>
  3. int v=0, c=0;
  4. %}
  5.  
  6. %%
  7. [ \t\n]+ ; /* ignore spaces */
  8. [AEIOUaeiou] { v++; } /* vowels */
  9. [B-DF-HJ-NP-TV-Zb-df-hj-np-tv-z] { c++; } /* consonants */
  10. . ; /* ignore others */
  11. %%
  12.  
  13. int main(){
  14. printf("Enter the input string: ");
  15. yylex();
  16. printf("\nNo of vowels are : %d", v);
  17. printf("\nNo of consonants are : %d", c);
  18. return 0;
  19. }
  20.  
  21. int yywrap(){
  22. return 1;
  23. }
Success #stdin #stdout #stderr 0.02s 6936KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/iMKWop/prog:2:1: Syntax error: Operator expected
ERROR: /home/iMKWop/prog:23:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit