[gnu.gdb.bug] cutting down shift/reduce conflicts in expread.y

alverson@decwrl.dec.com (alverson) (04/15/89)

You can cut the S/R conflicts in expread.y down to 1 (and leave the
reduce/reduce conflicts at 1) by adding a few precedence rules.
Here are diffs from expread.y in gdb 3.1.2

Bob Alverson (alverson@decwrl.dec.com)

*** src/expread.y	Tue Jan 17 11:30:36 1989
--- expread.y	Fri Apr 14 13:33:05 1989
***************
*** 139,144
  %left ','
  %left ABOVE_COMMA
  %right '=' ASSIGN_MODIFY
  %left OR
  %left AND
  %left '|'

--- 139,145 -----
  %left ','
  %left ABOVE_COMMA
  %right '=' ASSIGN_MODIFY
+ %right '?'
  %left OR
  %left AND
  %left '|'
***************
*** 151,157
  %left '*' '/' '%'
  %left '@'
  %right UNARY INCREMENT DECREMENT
! %right ARROW '.' '['
  %left COLONCOLON
  
  %%

--- 152,158 -----
  %left '*' '/' '%'
  %left '@'
  %right UNARY INCREMENT DECREMENT
! %right ARROW '.' '[' '('
  %left COLONCOLON
  
  %%
***************
*** 232,238
  			/* This is to save the value of arglist_len
  			   being accumulated by an outer function call.  */
  			{ start_arglist (); }
! 		arglist ')'
  			{ write_exp_elt_opcode (OP_FUNCALL);
  			  write_exp_elt_longcst (end_arglist ());
  			  write_exp_elt_opcode (OP_FUNCALL); }

--- 233,239 -----
  			/* This is to save the value of arglist_len
  			   being accumulated by an outer function call.  */
  			{ start_arglist (); }
! 		arglist ')'	%prec ARROW
  			{ write_exp_elt_opcode (OP_FUNCALL);
  			  write_exp_elt_longcst (end_arglist ());
  			  write_exp_elt_opcode (OP_FUNCALL); }
***************
*** 343,349
  			{ write_exp_elt_opcode (BINOP_OR); }
  	;
  
! exp	:	exp '?' exp ':' exp
  			{ write_exp_elt_opcode (TERNOP_COND); }
  	;
  			  

--- 344,350 -----
  			{ write_exp_elt_opcode (BINOP_OR); }
  	;
  
! exp	:	exp '?' exp ':' exp	%prec '?'
  			{ write_exp_elt_opcode (TERNOP_COND); }
  	;
  			  
***************
*** 399,405
  			  write_exp_elt_opcode (OP_INTERNALVAR); }
  	;
  
! exp	:	SIZEOF '(' type ')'
  			{ write_exp_elt_opcode (OP_LONG);
  			  write_exp_elt_type (builtin_type_int);
  			  write_exp_elt_longcst ((long) TYPE_LENGTH ($3));

--- 400,406 -----
  			  write_exp_elt_opcode (OP_INTERNALVAR); }
  	;
  
! exp	:	SIZEOF '(' type ')'	%prec UNARY
  			{ write_exp_elt_opcode (OP_LONG);
  			  write_exp_elt_type (builtin_type_int);
  			  write_exp_elt_longcst ((long) TYPE_LENGTH ($3));