diff options
| author | Gabriel Kerneis | 2014-02-18 16:28:26 +0000 |
|---|---|---|
| committer | Gabriel Kerneis | 2014-02-18 16:28:26 +0000 |
| commit | 3dd4e21dc8a0c1782c3cb8d072388612f270facb (patch) | |
| tree | 4cb5d573fa9c95dd81cdf32e70206d6fd38bc83b /src | |
| parent | 31cec8cf6de8f94c642a4700322e50a26e88e32d (diff) | |
Improve interpreter pretty-printing
Diffstat (limited to 'src')
| -rw-r--r-- | src/lem_interp/run_interp.ml | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lem_interp/run_interp.ml b/src/lem_interp/run_interp.ml index 3f39d543..1c3c76d6 100644 --- a/src/lem_interp/run_interp.ml +++ b/src/lem_interp/run_interp.ml @@ -22,18 +22,26 @@ let id_to_string = function | Id s | DeIid s -> s ;; +let bitvec_to_string l = "0b" ^ (String.concat "" (List.map (function + | V_lit(L_zero) -> "0" + | V_lit(L_one) -> "1" + | _ -> assert false) l)) +;; + let rec val_to_string = function | V_boxref n -> sprintf "boxref %d" n - | V_lit l -> sprintf "literal %s" (lit_to_string l) + | V_lit l -> sprintf (*"literal %s" *) "%s" (lit_to_string l) | V_tuple l -> let repr = String.concat ", " (List.map val_to_string l) in - sprintf "tuple (%s)" repr + sprintf "tuple <%s>" repr | V_list l -> let repr = String.concat "; " (List.map val_to_string l) in sprintf "list [%s]" repr | V_vector (first_index, inc, l) -> let order = if inc then "little-endian" else "big-endian" in - let repr = String.concat "; " (List.map val_to_string l) in + let repr = + try bitvec_to_string l + with Failure _ -> String.concat "; " (List.map val_to_string l) in sprintf "vector [%s] (%s, from %s)" repr order (string_of_big_int first_index) | V_record l -> let pp (id, value) = sprintf "%s = %s" (id_to_string id) (val_to_string value) in |
