summaryrefslogtreecommitdiff
path: root/src/toFromInterp_backend.ml
diff options
context:
space:
mode:
authorJon French2019-04-12 14:45:04 +0100
committerJon French2019-04-12 14:45:04 +0100
commitf254b36fe1157df8ff620536f13eb289d781e28f (patch)
tree754fe0168ebeb4c073ad8607920c7e88d79148b9 /src/toFromInterp_backend.ml
parent566296e39a3f6cd472d86c13e075c3d8b8c1bf03 (diff)
ToFromInterp_backend: better handling of nexps
Diffstat (limited to 'src/toFromInterp_backend.ml')
-rw-r--r--src/toFromInterp_backend.ml10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/toFromInterp_backend.ml b/src/toFromInterp_backend.ml
index e35af091..43166f77 100644
--- a/src/toFromInterp_backend.ml
+++ b/src/toFromInterp_backend.ml
@@ -69,10 +69,11 @@ let frominterp_typedef (TD_aux (td_aux, (l, _))) =
let fromValueKid (Kid_aux ((Var name), _)) =
string ("typq_" ^ name)
in
- let fromValueNexp (Nexp_aux (nexp_aux, _)) = match nexp_aux with
+ let fromValueNexp ((Nexp_aux (nexp_aux, annot)) as nexp) = match nexp_aux with
| Nexp_constant num -> parens (separate space [string "Big_int.of_string"; dquotes (string (Nat_big_num.to_string num))])
| Nexp_var var -> fromValueKid var
- | _ -> string "NEXP"
+ | Nexp_id id -> string (string_of_id id ^ "FromInterpValue")
+ | _ -> string ("NEXP(" ^ string_of_nexp nexp ^ ")")
in
let rec fromValueTypArg (A_aux (a_aux, _)) = match a_aux with
| A_typ typ -> fromValueTyp typ ""
@@ -196,10 +197,11 @@ let tointerp_typedef (TD_aux (td_aux, (l, _))) =
let toValueKid (Kid_aux ((Var name), _)) =
string ("typq_" ^ name)
in
- let toValueNexp (Nexp_aux (nexp_aux, _)) = match nexp_aux with
+ let toValueNexp ((Nexp_aux (nexp_aux, _)) as nexp) = match nexp_aux with
| Nexp_constant num -> parens (separate space [string "Big_int.of_string"; dquotes (string (Nat_big_num.to_string num))])
| Nexp_var var -> toValueKid var
- | _ -> string "NEXP"
+ | Nexp_id id -> string (string_of_id id ^ "ToInterpValue")
+ | _ -> string ("NEXP(" ^ string_of_nexp nexp ^ ")")
in
let rec toValueTypArg (A_aux (a_aux, _)) = match a_aux with
| A_typ typ -> toValueTyp typ ""