Fix operator precedence
This commit is contained in:
parent
bacfd64bae
commit
27457eb6e2
1 changed files with 6 additions and 6 deletions
12
parser.ml
12
parser.ml
|
@ -17,18 +17,18 @@ let unexpected_token t =
|
|||
* precedency, but infering precedence relation from the graph is hard
|
||||
* and the graph can be made to have loops, I just used plain table. *)
|
||||
let precedence = [
|
||||
Eq, 1;
|
||||
Neq, 1;
|
||||
GE, 1;
|
||||
LE, 1;
|
||||
GT, 1;
|
||||
LT, 1;
|
||||
Add, 10;
|
||||
Sub, 10;
|
||||
Mul, 20;
|
||||
Div, 20;
|
||||
Mod, 30;
|
||||
Exp, 30;
|
||||
Eq, 100;
|
||||
Neq, 100;
|
||||
GE, 100;
|
||||
LE, 100;
|
||||
GT, 100;
|
||||
LT, 100;
|
||||
] |> List.to_seq |> Hashtbl.of_seq
|
||||
|
||||
let precedence_of op =
|
||||
|
|
Loading…
Add table
Reference in a new issue