Ex2 (b)

merge term and factor into exp, and add %left rules for the operators:
%type  exp
%left add_sub
%left mul_div

exp	: exp add_sub exp	{$$= make_operator ($1, $2, $3);}
	| exp mul_div exp	{$$= make_operator ($1, $2, $3);}
	| number		{$$= make_operand ($1);}
	| '(' exp ')'		{$$= $2;}
	;
This gives the same (abstract) parse trees as the original version. It is very easy to change %left to %right or %nonassoc, or to swap the %left lines around, to see how the parse trees change. In particular, see which changes correspond to 6b), 6c), 7b), 7c) and 7d).

For 7d), you have to merge the two %left lines into one!