summaryrefslogtreecommitdiff
path: root/src/Pure.ml
diff options
context:
space:
mode:
authorSon Ho2022-01-24 17:43:43 +0100
committerSon Ho2022-01-24 17:43:43 +0100
commit87920de32e7704be6b490462b241626f18cc96f7 (patch)
treee8ac77ecba0ea5696a7744529986267473624e12 /src/Pure.ml
parente5dce61f35fcc0e716f7aadc32f254c8ba103887 (diff)
Start working on translation of the type definitions
Diffstat (limited to 'src/Pure.ml')
-rw-r--r--src/Pure.ml19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Pure.ml b/src/Pure.ml
index 4201c4b6..fcf8e6f0 100644
--- a/src/Pure.ml
+++ b/src/Pure.ml
@@ -3,6 +3,7 @@ module T = Types
module V = Values
module E = Expressions
module A = CfimAst
+module TypeDefId = T.TypeDefId
module TypeVarId = T.TypeVarId
module RegionId = T.RegionId
module VariantId = T.VariantId
@@ -30,6 +31,24 @@ type ty =
| Str
| Array of ty (* TODO: there should be a constant with the array *)
| Slice of ty
+[@@deriving show]
+
+type field = { field_name : string; field_ty : ty } [@@deriving show]
+
+type variant = { variant_name : string; fields : field list } [@@deriving show]
+
+type type_def_kind = Struct of field list | Enum of variant list
+[@@deriving show]
+
+type type_var = T.type_var [@@deriving show]
+
+type type_def = {
+ def_id : TypeDefId.id;
+ name : name;
+ type_params : type_var list;
+ kind : type_def_kind;
+}
+[@@deriving show]
type scalar_value = V.scalar_value