title: flex bison : creating multiple character variable
body: <p>I want to create a programming language consisting multiple character variables (e.g. abc=10, num=120). I was able to create single character variable . The .y code is :</p>
  
  <pre><code>%{
      #include &lt;stdio.h&gt;
                    //char sym[1000];
      //int x=0;
      int sym[26];
  
  %}
  
  
  %token NUMBER ADD SUB MUL DIV ABS EOL ID ASS
  %%
  calclist : 
      | calclist exp EOL   { printf("= %d\n", $2); } 
      | ID ASS exp EOL     { sym[$1] = $3;
  
               }
  ;
  exp:    factor           { $$=$1; }
      | exp ADD factor     { $$ = $1 + $3; }
      | exp SUB factor     { $$ = $1 - $3; }
  ;
  factor :    term         { $$=$1; }
      | factor MUL term    { $$ = $1 * $3; }
      | factor DIV term    { $$ = $1 / $3; }
  ;
  term :  NUMBER       { $$=$1; }
  
  ;
  
  %%
  int main(int argc, char **argv)
  {
  yyparse();
  }
  yyerror(char *s)
  {
  fprintf(stderr, "error: %s\n", s);
  } 
  </code></pre>
  
  <p>and the .l code is :</p>
  
  <pre><code>%{
  # include "P3.tab.h"
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  extern int yylval;
  //int m=0;
  %}
  
  %%
  "+"     { return ADD; }
  "-"     { return SUB; }
  "*"  { return MUL; }
  "/"     { return DIV; }
  "=" { return ASS; }
  [a-z]+  { yylval= *yytext  - 'a' ;  
       return ID ; }
  [0-9]+  { yylval = atoi(yytext); return NUMBER; }
  \n   { return EOL; }
  [ \t]   { /* ignore whitespace */ }
  .    { printf("Mystery character %c\n", *yytext); }
  %%
  int yywrap()
  {
  return 1;
  }
  </code></pre>
  
  <p>So, with this code , I can only create a=10,x=90 kind of single character variable . How can I create multiple character variable And I also want to check if it is already declared or not ?</p>