diff --git a/src/main/interpret.ml b/src/main/interpret.ml index ca2c988..b18a907 100644 --- a/src/main/interpret.ml +++ b/src/main/interpret.ml @@ -27,7 +27,13 @@ let fun_of_op = function | Minus -> ( - ) | Times -> ( * ) | Divide -> ( / ) - | _ -> failwith "Unimplemented operator." + | Leq -> (fun x y -> if x <= y then 1 else 0) + | Geq -> (fun x y -> if x >= y then 1 else 0) + | Equal -> (fun x y -> if x = y then 1 else 0) + | Noteq -> (fun x y -> if x != y then 1 else 0) + | And -> (fun x y -> if x=1 && y=1 then 1 else 0) + | Or -> (fun x y -> if x=1 || y=1 then 1 else 0) + | Not -> (fun x y -> if y=1 then 0 else 1) (* Interpret an expression *) let rec interpret symt = function