diff --git a/src/parser.mly b/src/parser.mly index b30ccde7..d20954be 100644 --- a/src/parser.mly +++ b/src/parser.mly @@ -565,13 +565,13 @@ exprcons: | e=exprplus { e } ; exprplus: - | e1=exprtimes; op=BINOP_PLUS; e2=exprplus { binary e1 op e2 } - | e1=exprtimes; op=BINOP_MINUS; e2=exprplus { binary e1 op e2 } + | e1=exprplus; op=BINOP_PLUS; e2=exprtimes { binary e1 op e2 } + | e1=exprplus; op=BINOP_MINUS; e2=exprtimes { binary e1 op e2 } | e=exprtimes { e } ; exprtimes: - | e1=exprapp; op=BINOP_TIMES; e2=exprtimes { binary e1 op e2 } - | e1=exprapp; op=BINOP_DIVIDES; e2=exprtimes { binary e1 op e2 } + | e1=exprtimes; op=BINOP_TIMES; e2=exprapp { binary e1 op e2 } + | e1=exprtimes; op=BINOP_DIVIDES; e2=exprapp { binary e1 op e2 } | e=exprapp { e } ; exprapp: diff --git a/test/pass/arith.sest b/test/pass/arith.sest index fbef7e0a..7df87798 100644 --- a/test/pass/arith.sest +++ b/test/pass/arith.sest @@ -3,6 +3,10 @@ module Arith = struct val main(_) = let 13 = 3 * 4 + 1 in let 13 = 1 + 3 * 4 in + let 1 = 4 / 2 / 2 in + let 8 = 8 * 2 / 2 in + let 14 = 57 - 42 - 1 in + let 16 = 57 - 42 + 1 in {} end