fork download
  1. %{
  2. #include<stdio.h>
  3. int consonant_count=0;
  4. int voel_count=0;
  5. %}
  6. %%
  7. [aeiouAEIOU] { vowel_count++; }
  8. [a-zA-Z] { consonant_count++; }
  9. .
  10. %%
  11. int yywrap(){
  12. return 1;
  13. }
  14. int main(){
  15. printf("enter the expresion");
  16. yylex();
  17. printf("Number of vowels in expression: %d\n",vowel_count);
  18. printf("Number of consonants in expression: %d\n",consonant_count);
  19. return 0;
  20. }
  21.  
Success #stdin #stdout #stderr 0.03s 6912KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/SCoofx/prog:2:3: Syntax error: Operator expected
ERROR: /home/SCoofx/prog:20:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit