title: use yylval in bison to recover a string
body: <p>hi im confusing about how to get a char* when i read a specific token...
  I look in various sites and they provide suggestions but not complete, i mean, for example yylval and yytext declaration is missing or how to transform the types, etc</p>
  
  <p>What is need in .l file?
  What is need in .y file?</p>
  
  <p>What I have</p>
  
  <p>in the .l file:</p>
  
  <pre><code>{WORD}      { yylval = strdup(yytext);return T_ValidWord;}
  </code></pre>
  
  <p>in the .y file:</p>
  
  <pre><code>%union{
    char *str;
  }
  
  %token&lt;str&gt; T_ValidWord
  
  %%
  
  element:
  T_OpenTag T_ValidWord ele1 {printf("%s", $2);}
  ; 
  </code></pre>
  
  <p>The error:</p>
  
  <pre><code>xml.lex: In function ‘yylex’:
  xml.lex:34: error: incompatible types when assigning to type ‘YYSTYPE’ from type ‘char *’
  </code></pre>
  
  <p>Other thing more that confused me:
  In some places i see</p>
  
  <pre><code>yylval-&gt;something = yytext
  yylval.something = yytext
  yylval = yytext
  </code></pre>
  
  <p>In the manual of bison tell that yylval is a macro, I understand that a macro is text replaced for other text, but in this situation i really don't get it.</p>