diff options
| author | Alasdair Armstrong | 2017-12-13 20:38:24 +0000 |
|---|---|---|
| committer | Alasdair Armstrong | 2017-12-13 21:07:18 +0000 |
| commit | e636947dd964eb849cfeff528fe43a85fee7583a (patch) | |
| tree | a5898231c62af9eaca02d7d6386feb6e48c7fe95 /src/value.ml | |
| parent | 2682a259a2a4a4ee34ddd6be6ea6f5dc3a3a15b7 (diff) | |
Cleanup code by fixing compiler warnings, and fix ocaml compilation
Add the ast.sed script we need to build sail. Currently we just need
this to fix up the locations in the AST but it will be removed once we
can share locations between ocaml and lem.
Diffstat (limited to 'src/value.ml')
| -rw-r--r-- | src/value.ml | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/value.ml b/src/value.ml index 4974ca83..f49b230c 100644 --- a/src/value.ml +++ b/src/value.ml @@ -69,6 +69,7 @@ let rec string_of_value = function | V_bool false -> "false" | V_bit B0 -> "bitzero" | V_bit B1 -> "bitone" + | V_int n -> Big_int.to_string n | V_tuple vals -> "(" ^ Util.string_of_list ", " string_of_value vals ^ ")" | V_list vals -> "[" ^ Util.string_of_list ", " string_of_value vals ^ "]" | V_unit -> "()" @@ -89,9 +90,17 @@ let coerce_bool = function | V_bool b -> b | _ -> assert false -let and_bool [v1; v2] = V_bool (coerce_bool v1 && coerce_bool v2) -let or_bool [v1; v2] = V_bool (coerce_bool v1 || coerce_bool v2) -let print [v] = print_endline (string_of_value v |> Util.red |> Util.clear); V_unit +let and_bool = function + | [v1; v2] -> V_bool (coerce_bool v1 && coerce_bool v2) + | _ -> assert false + +let or_bool = function + | [v1; v2] -> V_bool (coerce_bool v1 || coerce_bool v2) + | _ -> assert false + +let print = function + | [v] -> print_endline (string_of_value v |> Util.red |> Util.clear); V_unit + | _ -> assert false let tuple_value (vs : value list) : value = V_tuple vs |
