fork download
  1. %{
  2. #include <stdio.h>
  3.  
  4. int vowel_count = 0; // global variable to store vowel count
  5. %}
  6.  
  7. %%
  8. [AEIOUaeiou] { vowel_count++; } // match any vowel
  9. .|\n { /* ignore other characters */ }
  10. %%
  11.  
  12. int main() {
  13. yylex(); // start scanning input
  14. printf("Number of vowels: %d\n", vowel_count);
  15. return 0;
  16. }
  17.  
Success #stdin #stdout #stderr 0.03s 6720KB
stdin
abhinand is my name
i am a boy
stdout
Standard output is empty
stderr
ERROR: /home/7CXRJI/prog:16:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? % Execution Aborted
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit