Skip to content

Commit

Permalink
Having 'fun' hehehe
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisLane committed Nov 11, 2016
1 parent b0b16bc commit c385bac
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/interpret.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c385bac

Please sign in to comment.