title: Error on compiling C files generated ya YaCC and Lex
body: <p>I have two files which I am using to try and generate a parser.</p>
  
  <p><strong>File 1 :</strong> drive.l</p>
  
  <pre><code>%{
  #include&lt;stdio.h&gt;
  #include&lt;string.h&gt;    
  #include"y.tab.h"
  /*
  #define START   1
  #define STOP    2
  #define FWD     3
  #define BACK    4
  #define UP      5
  #define DOWN    6
  #define TURN    7
  #define LEFT    8
  #define RIGHT   9
  #define SET     10
  #define VAR     11
  #define DEGREE  12
  #define EQUAL   13
    */  
  struct VarTab{
      char VarName[50];
      int Id;
      struct Vartab* next;
      };
  struct DegTab{
      int Deg,Min,Sec;
      int Id;
      struct DegTab* next;
      };
  
  struct VarTab* VHead=NULL;
  struct DegTab* DHead=NULL;
  int VTop = 0;
  int DTop =0;
  %}
  
  delim           [ \t]
  ign             {delim}+
  var             [a-zA-Z]+[a-zA-Z0-9]+
  num             [0-9]
  degree          {num}+((\.{num})|(\.{num}\.{num}))?
  
  %%
  {ign}           /**/
  \n              {printf("\n");}
  START           {printf("&lt;STR&gt; ");return(START);}
  STOP            {printf("&lt;STP&gt; ");return(STOP);}
  FWD             {printf("&lt;FWD&gt; ");return(FWD);}
  BACK            {printf("&lt;BAK&gt; ");return(BACK);}
  UP              {printf("&lt;UP&gt; ");return(UP);}
  TURN            {printf("&lt;TUR&gt; ");return(TURN);}
  LEFT            {printf("&lt;LFT&gt; ");return(LEFT);}
  RIGHT           {printf("&lt;RGT&gt; ");return(RIGHT);}
  SET             {printf("&lt;SET&gt; ");return(SET);}
  =               {printf("&lt;EQL&gt; ");return(EQUAL);}
  {var}           {printf("&lt;VARIABLE&gt; ");RegVar();return(VAR);}
  {degree}        {printf("&lt;DEG&gt; ");RegDeg();return(DEGREE);}
  %%
  
  
  int RegVar(){
      /*
      int i;
      char var[50];
      char* rd = yytext;
      for(i=0;i&lt;=yyleng;i++){
          var[i-1] =  *rd;
          i++;
          rd++;
          }
      var[i-1]='\0';
      VTop++;
      struct VarTab* tmp;
      tmp-&gt;Id = VTop;
      strcpy(tmp-&gt;VarName,var);
      tmp-&gt;next = NULL;
      if(VHead==NULL)
          VHead = tmp;
      else{
          struct VarTab*  parse = VHead;
          while(parse-&gt;next!= NULL)
              parse = parse-&gt;next;
          parse-&gt;next = tmp;
  
          }*/
      return VTop;
      }
  
  int RegDeg(){
      /*
      int D=0,M=0,S=0;
      int st = 0;
      int i;
      char* rd;
      for(i=1;i&lt;=yyleng;i++){
          if(st==0){
              if(*rd != '.')
                  D = (D*10) + (*rd - 48);
              else
                  st =1;
              i++;
              rd++;
              }
          if(st==1){
              if(*rd!='.')
                  M = (M*10) + (*rd -48 );
              else
                  st =2;
                  rd++;
                  i++;
              }
          if(st==2){
              if(i&lt;=yyleng){
                  S = (S*10) + (*rd -48);
                  rd++;
                  i++;
              }
              }
          }
  
          DTop++;
          struct DegTab* tmp;
          tmp-&gt;Deg = D;
          tmp-&gt;Min = M;
          tmp-&gt;Sec = S;
          tmp-&gt;Id = DTop; 
          tmp-&gt;next = NULL;
          if(DHead == NULL)
              DHead = tmp;
          else{
              struct DegTab* parse;
              parse = DHead;
              while(parse-&gt;next!=NULL)
                  parse = parse-&gt;next;
              parse-&gt;next = tmp;
  
              }*/
  </code></pre>
  
  <p><strong>File 2:</strong> drive.y</p>
  
  <pre><code>%{
  #include&lt;stdio.h&gt;
  #include&lt;string.h&gt;    
  
  /*#define START   1
  #define STOP    2
  #define FWD     3
  #define BACK    4
  #define UP      5
  #define DOWN    6
  #define TURN    7
  #define LEFT    8
  #define RIGHT   9
  #define SET     10
  #define VAR     11
  #define DEGREE  12
  #define EQUAL   13
  */
  void yyerror(const char *str)
  {
          fprintf(stderr,"error: %s\n",str);
  }
  
  int yywrap()
  {
          return 1;
  } 
  
  main()
  {
          yyparse();
  } 
  
  
  
  %}
  
  %token TURN START STOP FWD BACK UP DOWN  LEFT RIGHT SET VAR  EQUAL DEGREE
  
  %%
  
  command :
              /*Empty*/
              | statuscode
              | valuecode
              | motioncode
              ;
  statuscode:
              START
              {
                  printf("Started.\n");
              }
              | STOP
              {
                  prinf("Stoping.\n");
              }
              | UP
              {
                  prinf("Up phase.\n");
              }
              | FWD
              {
                  print("Forward.\n");
              }
              | BACK
              {
                  printf("Backward.\n");
              }
              ;
  valuecode:
              SET VAR EQUAL DEGREE
              {
                  printf("Initialized a variable:\n");
              }
              ;
  motioncode:
              TURN direction
              {
                  printf("OK \n");
              }
              ;
  direction:
              LEFT DEGREE
              {
                  printf("Turning left with value - ");
              }
              | RIGHT DEGREE
              {
                  printf("tunring Right with value -");
              }
              | LEFT VAR
              {
                  printf("Turning Left with Variable -");
              }
              | RIGHT VAR
              {
                  printf("Turning Right with Variable\m");
              }
              ;
  
  
  %%
  </code></pre>
  
  <p>I tried to compile the code using the following commands and received and error.</p>
  
  <pre><code>$lex drive.l
  $ yacc -d drive.y
  $ cc lex.yy.c y.tab.c  -o ex -lfl
  drive.y: In function ‘yyparse’:
  drive.y:98:24: warning: unknown escape sequence: '\m' [enabled by default]
  /tmp/ccMVHgWf.o: In function `yyparse':
  y.tab.c:(.text+0x35e): undefined reference to `prinf'
  y.tab.c:(.text+0x36c): undefined reference to `prinf'
  y.tab.c:(.text+0x37a): undefined reference to `print'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>I could not find the error, It would be great help if someone could help me solve this problem.</p>