help-bison@gnu.org
[Top] [All Lists]

Token precedence only applies to tokens immediately before and after the

Subject: Token precedence only applies to tokens immediately before and after the parsing dot
From: Hans Aberg
Date: Tue, 12 May 2009 10:32:02 +0200
On 12 May 2009, at 09:06, Yinpeng Li wrote:

%left OR
%left AND
............................
%%
............................
predicate:    predicate OR predicate                            {
                   $$ = new AST_PredicateTreeNode($1, $3,
AST_PredicateTreeNode::OR) ;
                   REGISTER_AST_NODE($$) ;
               }
           |    predicate AND predicate                            {
                   $$ = new AST_PredicateTreeNode($1, $3,
AST_PredicateTreeNode::AND) ;
                   REGISTER_AST_NODE($$) ;
               }
           |    LEFT_PARENTHESIS predicate RIGHT_PARENTHESIS    {
                   $$ = $2 ;
               }
           ;

THE ERROR REPORT:
state 54

  17 predicate: predicate . OR predicate  [END_OF_COMMAND,
RIGHT_PARENTHESIS, OR]
  17          | predicate OR predicate .  [END_OF_COMMAND,
RIGHT_PARENTHESIS, OR]
  18          | predicate . AND predicate

   AND  shift, and go to state 40

   $default  reduce using rule 17 (predicate)

Conflict between rule 17 and token OR resolved as reduce (%left OR). Conflict between rule 17 and token AND resolved as shift (OR < AND).
_______________________________________________
help-bison@xxxxxxx http://lists.gnu.org/mailman/listinfo/help-bison



_______________________________________________
help-bison@xxxxxxx http://lists.gnu.org/mailman/listinfo/help-bison

<Prev in Thread] Current Thread [Next in Thread>