title: How to write a bison file to automatically use a token enumeration list define in a C header file?
body: <p>I am trying to build a parser with Bison/Yacc to be able to parse a flow of token done by another module. The tokens are already listed in a enumeration type as follow:</p>
  
  <pre><code>// C++ header file
  enum token_id {
    TokenType1         = 0x10000000,
    TokenType2         = 0x11000000,
    TokenType3         = 0x11100000,
    //... and the list go on with about 200/300 line
  };
  </code></pre>
  
  <p>I have gone through the documentation of bison many times but I couldn't find a better solution than copying each token in the Bison file like this:</p>
  
  <pre><code>/* Bison/Yacc file */
  %token TokenType1 0x10000000
  %token TokenType2 0x11000000
  %token TokenType3 0x11100000
  //...
  </code></pre>
  
  <p>If I have to do it like that, It will become pretty hard to maintain the file if the other module specification change (which happen quite oftenly).</p>
  
  <p>Could you please tell me how to do it, or point me in the good direction (any idea/comment is welcome). It would greatly help me! Thanks in advance. </p>