From 2621d84c1c8f596e2e776ec3794261ff3f93e9c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Mon, 11 Mar 2019 02:30:26 +0100 Subject: [PATCH] Simplified more expressions --- AST2.ml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/AST2.ml b/AST2.ml index fb454c14d..a3f37f7d8 100644 --- a/AST2.ml +++ b/AST2.ml @@ -60,7 +60,7 @@ module O = struct and operator = Or | And | Lt | Leq | Gt | Geq | Equal | Neq | Cat | Cons | Add | Sub | Mult | Div | Mod | Neg | Not - | Tuple | Set + | Tuple | Set | List | Function of string and constant = @@ -210,7 +210,7 @@ and s_expr : I.expr -> O.expr = | True c_True -> let () = ignore (c_True) in Constant (True) | Unit c_Unit -> let () = ignore (c_Unit) in Constant (Unit) | Tuple {value=(l,tuple,r); region} -> let () = ignore (l,r,region) in App { operator = Tuple; arguments = map s_expr (s_nsepseq tuple)} - | List {value=(lbrkt,lst,rbrkt); region} -> let () = ignore (lbrkt,rbrkt,region) in let _todo = lst in raise (TODO "simplify (expr,comma) list") + | List list -> s_list list | EmptyList empty_list -> s_empty_list empty_list | Set set -> s_set set | EmptySet empty_set -> s_empty_set empty_set @@ -221,6 +221,10 @@ and s_expr : I.expr -> O.expr = | MapLookUp {value=map_lookup; region} -> let _todo = map_lookup in let () = ignore (region) in raise (TODO "simplify MapLookUp") | ParExpr {value=(lpar,expr,rpar); region} -> let () = ignore (lpar,rpar,region) in s_expr expr +and s_list I.{value=(l, list, r); region} : O.expr = + let () = ignore (l, r, region) in + App { operator = List; arguments = map s_expr (s_nsepseq list) } + and s_set I.{value=(l, set, r); region} : O.expr = let () = ignore (l, r, region) in App { operator = Set; arguments = map s_expr (s_nsepseq set) }