error in my flex bison code

liunx

Guest
hi,<br /><br />can anyone explain me the error i get in my program<br />my program:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->%{<br />/***<br />  test parser for initial batch spreadsheet<br />***/<br />#include <stdio.h><br /><br />#include "ss.h"<br /><br />int yylex( void);               /* to avoid gcc warnings */<br />extern char *yytext;            /* current text matched by flex */<br />extern int yy_flex_debug;       /* flex debug flag */<br />%}<br /><br />%union{<br />  char *string;<br />  double number;<br />  Cell cell;<br />  Range range;<br />}<br /><br />%token <string> STRING<br />%token <number> NUMBER<br />%token <cell>   CELL<br />%token <range>  RANGE<br /><br />%token ABS<br />%token AVG<br />%token COPY<br />%type <n> expr post number assg stmt<br /><br />%%<br /><br />stmt:     /* nothing */<br />        | stmt '\n'                    { return 0; }<br />        | stmt CELL '=' expr '\n'<br />        | stmt CELL '=' STRING '\n'     {  add_string($4);  }<br />        | stmt COPY RANGE RANGE '\n'    {  do_copy($3,$4);  }<br />        | stmt error '\n'               { yyerrok; }<br />       ;<br /><br />expr:   assg<br />        {<br />          #if DEBUG<br />            print_list();<br />          #endif<br />          print_tree( root);<br />          putchar( '\n');<br />          free_tree( root);<br />          root = NULL;<br />        }<br />       ;<br />assg:   post<br />        | cell '=' assg<br />       ;<br />         <br />post:  primary<br />       | ABS  '('  expr ')'      { add_op( ABS, $3, 0);  }<br />       | AVG  '('  expr ')'      {  $$ = root = add_op( AVG, $3, 0);  }<br />      ;<br />            <br />primary:  number<br />          | cell<br />          | '(' expr ')' <br />         ;<br />          <br />number: {            }<br />       ;<br />        <br />cell:   {            }<br /><br />     ;<br />%%<br />         <br />int main( void)<br />{<br />#if YYDEBUG<br />    yydebug = 0;<br />#endif  <br />            <br />    yy_flex_debug = 0;<br />          <br />    return yyparse();    <br />}<br />          <br />void yyerror( const char *msg)          /* called for parser syntax error */<br />{<br />    printf( "error: %s\n", msg);<br />}<br /><br />int yywrap( void)                       /* called at EOF */<br />{        <br />    return 1;  <br />}<!--c2--></div><!--ec2--><br /><br /><br /><br />my error is:<br />Linux:felix$ make<br />make: *** Warning: File `parse.y' has modification time in the future (2007-11-01 19:19:27 > 2007-11-01 18:34:45.323685)<br />bison -t -v -d -o parse.c parse.y<br />parse.y:34: empty rule for typed nonterminal, and no action<br />parse.y:56: type clash (`n' `') on default action<br />parse.y:59: type clash (`n' `') on default action<br />parse.y:64: type clash (`' `n') on default action<br />make: *** [parse.c] Error 1<br /><br />please jhelp me out with this<br /><br />Regards,<br />Akshay
</div>
 
Back
Top