From 1ac8e96d5e441d4548c24d59fee67733f658e197 Mon Sep 17 00:00:00 2001 From: arckenimuz Date: Wed, 26 Jun 2024 12:01:42 +0100 Subject: [PATCH] refactor(syntax): replace ecmasl dynamic types with smtml.ty --- ECMA-SL/semantics/core/concrete/interpreter.ml | 4 ++-- .../semantics/core/functorial/symbolic_value.ml | 17 ----------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/ECMA-SL/semantics/core/concrete/interpreter.ml b/ECMA-SL/semantics/core/concrete/interpreter.ml index 1cfcf97a47..37178608ac 100644 --- a/ECMA-SL/semantics/core/concrete/interpreter.ml +++ b/ECMA-SL/semantics/core/concrete/interpreter.ml @@ -111,8 +111,8 @@ module M (Instrument : Instrument.M) = struct (* TODO:x should change?*) Random.self_init (); match t with - | Type.IntType -> Value.Int (Random.int 128) - | Type.FltType -> Value.Real (Random.float 128.0) + | Type.Ty_int -> Value.Int (Random.int 128) + | Type.Ty_real -> Value.Real (Random.float 128.0) | _ -> Log.fail "not implemented: symbolic %a" Type.pp t ) and eval_expr (state : state) (e : Expr.t) : Value.t = diff --git a/ECMA-SL/semantics/core/functorial/symbolic_value.ml b/ECMA-SL/semantics/core/functorial/symbolic_value.ml index aa2393f527..fc76168ac4 100644 --- a/ECMA-SL/semantics/core/functorial/symbolic_value.ml +++ b/ECMA-SL/semantics/core/functorial/symbolic_value.ml @@ -224,22 +224,6 @@ module M = struct fun vs -> E.(make (List vs)) | ArrayExpr -> assert false - let eval_type (t : Type.t) = - let open Ty in - match t with - | NullType -> Log.fail "eval_type null" - | IntType -> Ty_int - | FltType -> Ty_real - | StrType -> Ty_str - | BoolType -> Ty_bool - | SymbolType -> Log.fail "eval_type symbol" - | LocType -> Log.fail "eval_type loc" - | ArrayType -> Log.fail "eval_type array" - | ListType -> Ty_list - | TupleType -> Log.fail "eval_type tuple" - | TypeType -> Log.fail "eval_type type" - | CurryType -> Ty_app - let rec eval_expr (store : store) (e : Expr.t) : value = match e.it with | Val v -> E.value v @@ -270,7 +254,6 @@ module M = struct | _ -> Log.fail "error" ) | Symbolic (t, x) -> ( let x' = eval_expr store x in - let t = eval_type t in match E.view x' with | Val (Value.Str x') -> E.(make (Symbol (Symbol.make t x'))) | _ -> Log.fail "error" )