summaryrefslogtreecommitdiff
path: root/compiler/ExtractBase.ml
diff options
context:
space:
mode:
authorSon HO2023-12-14 16:49:34 +0100
committerGitHub2023-12-14 16:49:34 +0100
commitc3e0b90e422cbd902ee6d2b47073940c0017b7fb (patch)
tree92da14273eb068bcf418a2bdf9fbb6d27ba86102 /compiler/ExtractBase.ml
parentc6247e0c103cc1dc95c2a63ae01602c4a1208dc4 (diff)
parentb32fd66b71ad8fe28449d87a2e0334fdd36e286a (diff)
Merge pull request #53 from AeneasVerif/son/casts
Add support for casts between integers and booleans
Diffstat (limited to 'compiler/ExtractBase.ml')
-rw-r--r--compiler/ExtractBase.ml10
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/ExtractBase.ml b/compiler/ExtractBase.ml
index 93204515..eb2a2ec9 100644
--- a/compiler/ExtractBase.ml
+++ b/compiler/ExtractBase.ml
@@ -498,7 +498,7 @@ let char_name () = if !backend = Lean then "Char" else "char"
let str_name () = if !backend = Lean then "String" else "string"
(** Small helper to compute the name of an int type *)
-let int_name (int_ty : integer_type) =
+let int_name (int_ty : integer_type) : string =
let isize, usize, i_format, u_format =
match !backend with
| FStar | Coq | HOL4 ->
@@ -519,6 +519,14 @@ let int_name (int_ty : integer_type) =
| U64 -> Printf.sprintf u_format 64
| U128 -> Printf.sprintf u_format 128
+let scalar_name (ty : literal_type) : string =
+ match ty with
+ | TInteger ty -> int_name ty
+ | TBool -> (
+ match !backend with FStar | Coq | HOL4 -> "bool" | Lean -> "Bool")
+ | TChar -> (
+ match !backend with FStar | Coq | HOL4 -> "char" | Lean -> "Char")
+
(** Extraction context.
Note that the extraction context contains information coming from the