summaryrefslogtreecommitdiff
path: root/frontend/typing.ml
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/typing.ml')
-rw-r--r--frontend/typing.ml10
1 files changed, 7 insertions, 3 deletions
diff --git a/frontend/typing.ml b/frontend/typing.ml
index 07b3bcd..1545a38 100644
--- a/frontend/typing.ml
+++ b/frontend/typing.ml
@@ -13,8 +13,8 @@ type typ =
| TReal
| TEnum of string list
-let bool_true = "T"
-let bool_false = "F"
+let bool_true = "tt"
+let bool_false = "ff"
let bool_type = TEnum [bool_true; bool_false]
let t_of_ast_t = function
@@ -87,11 +87,15 @@ let rec type_expr_vl p vl cvl node expr =
(* do not check types of arguments... TODO? *)
let (n, _) = find_node_decl p f in
List.map (fun (_, _, t) -> t_of_ast_t t) n.ret
+ | AST_tuple x -> List.flatten (List.map sub x)
-(* type_expr : tp -> string -> typ list *)
+(* type_expr : tp -> string -> expr -> typ list *)
let type_expr tp = type_expr_vl tp.p tp.all_vars tp.const_vars
+let type_var tp node id =
+ let _, _, t = List.find (fun (_, x, _) -> x = (node^"/"^id)) tp.all_vars in t
+
(* Program rooting *)