title: unknown type yypcontext_t in bison
body: <p>I've been working with bison this last week and I wanted to make my parser produce some diagnostically, beautiful message that a person would understand.</p>
  <p>From this <a href="https://www.gnu.org/software/bison/manual/html_node/Syntax-Error-Reporting-Function.html" rel="nofollow noreferrer">GNU website</a>, I started declaring the function <code>int yyreport_syntax_error (const yypcontext_t *ctx)</code> in my <code>yacc.y</code> file like this:</p>
  <pre><code>%{
  /* some code above*/
  extern int yyreport_syntax_error (const yypcontext_t *ctx);
  %}
  </code></pre>
  <p>Ran bison with the command <code>bison -d yacc.y</code>, compiled it together with my lex.yy.c, and then clang; my compiler, greeted me happily with an error:</p>
  <pre><code>yacc.y:17:36: error: unknown type name 'yypcontext_t'
  extern yyreport_syntax_error(const yypcontext_t *yyctx);
                                     ^
  yacc.y:17:8: warning: type specifier missing, defaults to 'int'
        [-Wimplicit-int]
  extern yyreport_syntax_error(const yypcontext_t *yyctx);
  ~~~~~~ ^
  1 warning and 1 error generated.
  </code></pre>
  <p>Yes, clang reported that there's no type named 'yypcontext_t'.</p>
  <p>Did I forgot to include a bison library or explicitly typedef it? I don't think so, because none of it was written in the website.</p>
  <p>If you need elaboration, I would gladly do so.</p>
  <p>Bison version 3.6.3</p>
  <p><strong>MWE</strong>: test.y</p>
  <pre><code>%define parse.error custom
  
  %{
  #include &lt;stdio.h&gt;
  
  extern FILE *yyin;
  extern int yylex();
  extern int yyreport_syntax_error(const yypcontext_t *yyctx);
  
  %}
  
  %token SP
  
  %%
  
  file : SP
       ;
  
  %%
  
  int main(){
     yyparse();
     return 0;
  }
  </code></pre>
  <p>After running <code>bison -d test.y</code>, execute <code>gcc -c test.tab.c</code></p>