|if-then-else ambiguity email@example.com (Umm) (1997-04-16)|
|Re: if-then-else ambiguity firstname.lastname@example.org (Duncan Smith) (1997-04-18)|
|From:||Duncan Smith <email@example.com>|
|Date:||18 Apr 1997 01:33:42 -0400|
|Organization:||Flavors Technology, Inc.|
> Would it be a correct way, of solving a shift reduce problem in
> yacc/bison of the if-then-else by defining a %left precedence (the
> biggest one) to the else?? that way, we are sure (we were already but
> at least there will not be a warning) that in the presence of the
> else, it will be immediately reduced and not shifted, thus making it
> belong to the closest if.
> Is this correct??
I think the resolution must be to SHIFT. I believe this is the default
SHIFT leaves IF-THEN-ELSE on the stack which is then reduced.
REDUCE reduces the IF-THEN on the stack, leaving the ELSE as input to
match an Outer IF-THEN.
Return to the
Search the comp.compilers archives again.