title: How to know what line will be printed in yylineno?
body: <p>I'm using Lex and Bison parser generators.
  I have my .lex file, which defines the syntax  and .ypp file which defines the semantics. in my .ypp I have this line:</p>
  
  <pre><code>Statement : Type ID ASSIGN Exp {check_types_match($1.type, $4.type)} SC
  </code></pre>
  
  <ul>
  <li>Type can be <strong>int</strong> or <strong>boolean</strong>.</li>
  <li>ID is an identifier.</li>
  <li>ASSIGN is the <strong>=</strong> symbol.</li>
  <li>Exp can be many things, among them is <strong>Exp : true</strong>, which saves the type of the expression as boolean.</li>
  <li>SC is a semlicon "<strong>;</strong>".</li>
  <li>check_types_match checks for type mismatch and prints the line (yylineno) of the error if there's any.</li>
  </ul>
  
  <p>in this simple input file:</p>
  
  <pre><code>int x = true 
  ;
  </code></pre>
  
  <p>I get that the error is in line 2 and not in line 1. How can I make it print the error in line 1 instead?</p>