summaryrefslogtreecommitdiff
path: root/src/Pure.ml
diff options
context:
space:
mode:
authorSon Ho2022-01-28 22:17:28 +0100
committerSon Ho2022-01-28 22:17:28 +0100
commit2d40d81b4b9fde44fd924bad5a44b7392a1c9f1e (patch)
treeae92f07a33a48bb794a633647d7efa111edb2a94 /src/Pure.ml
parent0b145dd4b0ab0ac5ed56121663a25801f20bed67 (diff)
Make the pure expressions typed
Diffstat (limited to 'src/Pure.ml')
-rw-r--r--src/Pure.ml19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/Pure.ml b/src/Pure.ml
index dc35a181..bc655b63 100644
--- a/src/Pure.ml
+++ b/src/Pure.ml
@@ -445,7 +445,7 @@ class virtual ['self] mapreduce_expression_base =
type expression =
| Value of typed_rvalue * mplace option
| Call of call
- | Let of bool * typed_lvalue * expression * expression
+ | Let of bool * typed_lvalue * texpression * texpression
(** Let binding.
The boolean controls whether the let is monadic or not.
@@ -479,13 +479,13 @@ type expression =
...
```
*)
- | Switch of expression * switch_body
- | Meta of meta * expression (** Meta-information *)
+ | Switch of texpression * switch_body
+ | Meta of meta * texpression (** Meta-information *)
and call = {
func : fun_id;
type_params : ty list;
- args : expression list;
+ args : texpression list;
(** Note that immediately after we converted the symbolic AST to a pure AST,
some functions may have no arguments. For instance:
```
@@ -496,11 +496,14 @@ and call = {
}
and switch_body =
- | If of expression * expression
- | SwitchInt of T.integer_type * (scalar_value * expression) list * expression
+ | If of texpression * texpression
+ | SwitchInt of
+ T.integer_type * (scalar_value * texpression) list * texpression
| Match of match_branch list
-and match_branch = { pat : typed_lvalue; branch : expression }
+and match_branch = { pat : typed_lvalue; branch : texpression }
+
+and texpression = { e : expression; ty : ty }
[@@deriving
visitors
{
@@ -570,5 +573,5 @@ type fun_def = {
inputs_lvs : typed_lvalue list;
(** The inputs seen as lvalues. Allows to make transformations, for example
to replace unused variables by `_` *)
- body : expression;
+ body : texpression;
}