]> ruin.nu Git - proglang.git/commitdiff
explained the shift/reduce conflicts
authorMichael Andreen <harv@ruin.nu>
Tue, 7 Feb 2006 10:51:45 +0000 (10:51 +0000)
committerMichael Andreen <harv@ruin.nu>
Tue, 7 Feb 2006 10:51:45 +0000 (10:51 +0000)
documentation

index cf26d0aafadec73cf148288555cd48e3ee6ea6ef..2d3fcac33546a4e9ed73608a54d47478f0c34ac7 100644 (file)
@@ -9,3 +9,23 @@ integers and booleans.
 comments:
 // and /* */ comments are allowed.
 
+shift/reduce conflicts:
+
+30 conflicts in total.
+
+1) Exp1 followed by (<,<=,>,>=,==,!=,+,-) 8 conflicts:
+In these cases the Exp1 could've been reduced to Exp, but happy does the correct thing and shifts the operator token onto the stack, since Exp followed by these operators doesn't match any rules.
+
+2) Exp2 followed by (*,/) 6 conflicts:
+In two cases the Exp2 expression could be reduced to Exp1, but this wouldn't match the rules for these operators, so shifting is the correct action.
+
+In four other cases the Exp2 in front of these operators can be reduced to addition and subtraction expressions, which would destroy operator priority, so shifting is correct here.
+
+3) Exp1 followed by (+,-) 12 conflicts:
+In all these cases Exp1 could be reduced together with another Exp1 and a comparative operator to an Exp, but just as in the above case this would be very bad for operator priority, so shifting is right here.
+
+4) if with else: 1 conflict
+An if statement before the else could be reduced to an if statement lacking the else, but the correct thing is to shift it onto the stack.
+
+5) if/ifelse/while followed by (;): 3 conflicts
+Here we have redundant semicolons, these could all be reduced to individual statements without the ';'. Such a reduction wouldn't cause any harm, but neither does the shifting, it's an ok choice.