Skip to content

Commit

Permalink
add comparison ops for study
Browse files Browse the repository at this point in the history
  • Loading branch information
disconcision committed Nov 4, 2024
1 parent e5cf2ce commit 0607480
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/hazel/Grammar.re
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ module Exp = {
let add_op = op_alt(["+", "+.", "-", "-.", "@", "++"]);
let mult_op = op_alt(["*", "*.", "/", "/."]);
let neg_op = op_alt(["-", "-."]);
let comp_op_int = op_alt(["<", "<=", ">", ">=", "==", "!="]);
let comp_op_float = op_alt(["<.", "<=.", ">", ">=.", "==", "!="]);

let fn_ap = seq([exp, brc(L, "("), comma_sep(exp), brc(R, ")")]);

Expand Down Expand Up @@ -154,6 +156,9 @@ module Exp = {
p(~a=L, seq([exp, add_op, exp])),
p(~a=L, seq([exp, mult_op, exp])),
p(seq([neg_op, exp])),
//Comparison
p(~a=L, seq([exp, comp_op_int, exp])),
p(~a=L, seq([exp, comp_op_float, exp])),
//ap
p(fn_ap),
//Reverse-ap
Expand Down

0 comments on commit 0607480

Please sign in to comment.