From c385bac2edc3a85b902c107be8f093934f93d5e2 Mon Sep 17 00:00:00 2001 From: Chris Lane Date: Fri, 11 Nov 2016 02:57:17 +0000 Subject: [PATCH] Having 'fun' hehehe --- src/main/interpret.ml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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