fork download
  1. %{
  2. void display(int, char *);
  3. int flag;
  4. %}
  5.  
  6.  
  7. %%
  8. [a|e|i|o|u]+ {
  9. flag = 1;
  10. display(flag, yytext);
  11. }
  12. . {
  13. flag = 0;
  14. display(flag, yytext);
  15. }
  16.  
  17.  
  18. %%
  19.  
  20.  
  21. void main()
  22. {
  23. printf("\nEnter a character to check whether it is vowel or NOT\n");
  24. yylex();
  25. }
  26.  
  27.  
  28. void display(int flag, char *t)
  29. {
  30. if(flag==1)
  31. printf("\nThe given character %s is a vowel\n", t);
  32. else
  33. printf("\nThe given character %s not is a vowel\n", t);
  34. }
  35.  
Success #stdin #stdout #stderr 0.03s 6944KB
stdin
a
stdout
Standard output is empty
stderr
ERROR: /home/1oebPI/prog:2:5: Syntax error: Operator expected
ERROR: /home/1oebPI/prog:34:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit