Hi... maybe someone with more bison experience could lend a hand? Any help is greatly appreciated.

I'm trying to parse a simple algebraic (Boolean) expression using the grammar described below. However, I would like to be able to parse implicit multiplication (i.e. if two expression appear next to each other without an operator, they should be mulitplied). For example,

a b + (c + d)g
should parse the same as

a * b + (c + d) * g

As written below, there are several shift/reduce conflicts caused by the last rule (the implicit multiplication). I have no idea how to rewrite this unambiguously.

%left '|' '+'
%left '^'
%left '&' '*'
%nonassoc '\''
%nonassoc '!'

expression:
  IDENTIFIER
  | '(' expression ')'
  | expression '*' expression
  | expression '&' expression
  | expression '+' expression
  | expression '|' expression
  | expression '^' expression
  | '!' expression
  | expression '\''

  | expression expression %prec '*'   /* this rule causes problems */
  ;

----------------------------------
Aaron Hurst
[EMAIL PROTECTED]



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

Reply via email to