Skip to content

Commit

Permalink
fix the associativity of binary operators
Browse files Browse the repository at this point in the history
  • Loading branch information
gfngfn committed Dec 12, 2021
1 parent a37ba50 commit 5b11d37
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 5b11d37

Please sign in to comment.