fork download
  1. %{
  2. #include<stdio.h>
  3. #include<string.h>
  4. int c=0,v=0,p=0,n=0,z=0;
  5. %}
  6. %%
  7. [a,e,i,o,u,A,E,I,O,U] {v++;}
  8. [b-d,B-D,f-h,F-H,j-n,J-N,p-t,P-T,v-z,V-Z] {c++;}
  9. [1-9] {p++;}
  10. -[1-9] {n++;}
  11. 0 {z++;}
  12. %%
  13. int main(){
  14. printf("enter string\n");
  15. yylex();
  16. printf("number of vowels = %d\n",v);
  17. printf("number of consonents = %d\n",c);
  18. printf("number of positive numbers = %d\n",p);
  19. printf("number of negative numbers = %d\n",n);
  20. printf("number of zeros =%d\n",z);
  21. }
Success #stdin #stdout #stderr 0.03s 6892KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/VknDGc/prog:21:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit