title: yylval undefined with flex and bison
body: <p>I have searched almost every material online. But I am still confused why lexer cannot identify yylval. </p>
  
  <p>Here is the case:
  I have defined a bunch of ADT in <code>node.h</code> and realize them in <code>node.c</code>, my purpose is to generate a AST after these structures are properly stored. But I am stucked with bison file. </p>
  
  <p>First, I change <code>%union</code> to <code>union YYSTYPE {...};</code> and <code>typedef union YYSTYPE YYSTYPE;</code>, I don't why I need to do this, some other files posted online seems to work well with <code>%uinion</code>. </p>
  
  <p>Then, I am stucked with <code>yylval</code> things. I have done <code>bison -d</code> things, and checked it already in <code>parser.c</code>(I have specified the bison output), so I think <code>extern YYSTYPE yylval;</code> should work. But it doesn't. So I wonder if there is another way to solve yylval undeclared problem.</p>
  
  <p>I only use the two types of <code>YYSTYPE</code> struct, <code>int</code> and <code>char *</code>, can I separate the union <code>YYSYTPE</code> and struct for the AST? This means, the nonterminals will have no associated types. Do you guys have any other ideas??</p>