title: values from lexer are showing up in parser one value after expected one
body: <p>I am just starting out with using bison and am having trouble figuring out the behaviour. In a simple example, I have the string "{header: {version: 2, type: 4}}" that I am trying to parse. I need to extract the values 2 and 4 from the string. When I have the rules defined as</p>
  
  <pre><code>line_test: T_OPEN_BRACE T_HEADER T_OPEN_BRACE expression T_COMMA expression T_CLOSE_BRACE T_CLOSE_BRACE /* (rule 1) */
  ;
  
  expression: T_VERSION T_NUMBER { printf("returned %d\n", $1); } /* (rule 2) */
        | T_TYPE T_NUMBER    { printf("returned %d\n", $1); }     /* (rule 3) */
  ;
  </code></pre>
  
  <p>what I get is that at the printf at the 2nd Rule T_NUMBER evaluates to 0 and at the printf at the 3rd Rule T_NUMBER evaluates to 2, meaning that the values somehow are shifted from the appropriate values they are supposed to be.</p>
  
  <p>If I change the rules to be</p>
  
  <pre><code>line_test: T_OPEN_BRACE T_HEADER T_OPEN_BRACE expression T_COMMA expression T_CLOSE_BRACE T_CLOSE_BRACE /* (rule 1) */
  ;
  
  expression: T_VERSION number /* (rule 2) */
            | T_TYPE number    /* (rule 3) */
  ;
  
  number: T_NUMBER { printf("returned %d\n", $1); } /* rule 4 */
  ;
  </code></pre>
  
  <p>then the printf at the 4th rule is evaluated correctly both times, it first shows up 2, then 4. I looked at the state output of bison, and it all makes sense. My question is, why does this unexpected behaviour for the first set of Grammar rules happen? I can post my lexer or the full parser code, or even the bison state output if relevant.</p>