title: How to tokenize String in Lex and Yacc
body: <p>with reference to <a href="https://stackoverflow.com/questions/22346554/reading-new-line-giving-syntax-error-in-lex-yacc">Reading new line giving syntax error in LEX YACC</a>
   lex file we are using </p>
  
  <pre><code> %{
          /*
              parser for ssa;
          */
  
      #include&lt;stdio.h&gt;
      #include&lt;stdlib.h&gt;
      #include"y.tab.h"
  
  
      %}
      %%
      [\t]+   ;
      \n  ;
  
  
  
      [if]+       printf("first input\n");
      [else]+     return(op);
      [=]+        return(equal);
      [+]+        return(op);
      [*]+        return(op);
      [-]+        return(op);
  
      [\&lt;][b][b][ ]+[1-9][\&gt;] {return(bblock);}
  
      ([[_][a-z]])|([a-z][_][0-9]+)|([0-9]+)  {return(var);}
  
      .   ;
  
  
  
  
      %%
  </code></pre>
  
  <p>what should i do if i want to get token as a string i.e a_2
  how to do it????</p>
  
  <p>input file is </p>
  
  <pre><code>a_2 = _6 + b_3; 
    a_8 = b_7 - c_5;
  </code></pre>
  
  <hr>