From e9540a215947d946379d555b88c57f7c283ba0fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwena=C3=ABl=20Delaval?= Date: Mon, 18 Jan 2016 17:24:51 +0100 Subject: [PATCH] hepts: enum types & alias The graphical simulator hepts now support type aliasing. --- compiler/main/hepts.ml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/compiler/main/hepts.ml b/compiler/main/hepts.ml index 941121f..bf98da6 100644 --- a/compiler/main/hepts.ml +++ b/compiler/main/hepts.ml @@ -269,15 +269,20 @@ let create_input v_name v_ty n (table:GPack.table) = | Tid{ qual = Pervasives; name = "bool" } -> new boolean_input table n | Tid(name) -> - begin try - let ty = find_type name in - begin match ty with - | Tenum(clist) -> new enum_input name.qual clist table n - | _ -> new entry_input "" table n - end - with Not_found -> - new entry_input "" table n - end + let rec input name = + let _ = check_type name in + begin try + let ty = find_type name in + begin + match ty with + | Tenum(clist) -> new enum_input name.qual clist table n + | Talias(Tid name) -> input name + | _ -> new entry_input "" table n + end + with Not_found -> + new entry_input "" table n + end in + input name | _ -> failwith("Arrays and tuples not yet implemented") let create_output v_name _v_ty n (table:GPack.table) =