title: My lex program isn't working
body: <pre><code>/* def*/
  %{
  #include &lt;stdio.h&gt;
  int vowelCount = 0;
  int consonantCount = 0;
  %}
  
  /*RULES*/
  %%
  [aeiouAEIOU] {vowelCount = vowelCount + 1;}
  [A-Za-z][^aeiouAEIOU] {consonantCount = consonantCount + 1;}
  %%
  
  /*fct*/
  int main(void)
  {
      yylex();
      printf ("il y a %d voyelles",vowelCount);
      printf ("il y a %d consonnes",consonantCount);
      return 0;
  }
  </code></pre>
  
  <p>This is my first ever lex program. I want it to count how many vowels and how many consonants are in the source..</p>
  
  <p>I'm having 2 problems:</p>
  
  <ol>
  <li><p>I don't get the <code>printf</code> after yylex until after doing Ctrl+C, and stopping execution. so yylex isn't letting any instructions after it, execute unless I quit stop the entire execution </p></li>
  <li><p>I'm not geting the correct numbers.
  For example for "good",
  I got 1 vowel and 1 consonant instead of 2 vowels and 2 consonants.</p></li>
  </ol>
  
  <p>What do I need to do to fix these problems?</p>