diff --git a/src/compiler.c b/src/compiler.c index cad094f..fed6db8 100644 --- a/src/compiler.c +++ b/src/compiler.c @@ -812,7 +812,7 @@ static void compare(int exprType, RewindState *rewind) { static void binary(int exprType, RewindState *rewind) { KrkTokenType operatorType = parser.previous.type; ParseRule * rule = getRule(operatorType); - parsePrecedence((Precedence)(rule->precedence + 1)); + parsePrecedence((Precedence)(rule->precedence + (rule->precedence != PREC_EXPONENT))); invalidTarget(exprType, "operator"); switch (operatorType) { diff --git a/test/testPow.krk b/test/testPow.krk new file mode 100644 index 0000000..8958df4 --- /dev/null +++ b/test/testPow.krk @@ -0,0 +1 @@ +print(2**3**4) diff --git a/test/testPow.krk.expect b/test/testPow.krk.expect new file mode 100644 index 0000000..5305e62 --- /dev/null +++ b/test/testPow.krk.expect @@ -0,0 +1 @@ +2417851639229258349412352