🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by alverson Fri, 14 Apr 1989 20:54
cutting down shift/reduce conflicts in expread.y
#753
Author: alverson
Date: Fri, 14 Apr 1989 20:54
97 lines
2818 bytes
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));
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads