From: Siraaj Khandkar Date: Fri, 14 Sep 2018 15:12:52 +0000 (-0400) Subject: Remove unused code X-Git-Url: https://git.xandkar.net/?a=commitdiff_plain;h=862e5c05ffb0ec1ea8973af0c3c4384f70790ea3;p=tiger.ml.git Remove unused code --- diff --git a/compiler/src/lib/tiger/tiger_semant.ml b/compiler/src/lib/tiger/tiger_semant.ml index a0fdf3d..f653e16 100644 --- a/compiler/src/lib/tiger/tiger_semant.ml +++ b/compiler/src/lib/tiger/tiger_semant.ml @@ -19,18 +19,19 @@ module Semant : sig * Appel's *) val transExp : env:Env.t -> A.exp -> expty - val transVar : env:Env.t -> A.var -> expty - val transDec : env:Env.t -> A.dec -> Env.t - val transTy : env:Env.t -> A.ty -> Type.t (* needs only type env *) + + (* transVar does not seem to be needed, as trvar handles all our cases. + * Am I wrong? + * + * val transVar : env:Env.t -> A.var -> expty + * + *) end = struct type expty = { exp : Translate.exp ; ty : Type.t } - let unimplemented () = - failwith "unimplemented" - let return ty = {exp = (); ty} let return_unit = return Type.Unit let return_nil = return Type.Nil @@ -235,7 +236,7 @@ end = struct ) in trexp exp - and transDec ~env dec = + and transDec ~(env : Env.t) (dec : A.dec) : Env.t = (match dec with | A.VarDec {name; typ=typ_opt; init; pos=pos_outter; escape=_} -> let ty = @@ -279,7 +280,7 @@ end = struct Env.set_val env name (Value.Fun {formals; result}) ) ) - and transTy ~env typ = + and transTy ~(env : Env.t) (typ : A.ty) : Type.t = (match typ with | A.NameTy {symbol=sym; pos} -> env_get_typ ~sym ~env ~pos @@ -295,16 +296,6 @@ end = struct let element_ty = env_get_typ ~sym ~env ~pos in Type.new_array element_ty ) - - let transVar ~env:_ var = - (match var with - | A.SimpleVar {symbol=_; _} -> - unimplemented () - | A.FieldVar {var=_; symbol=_; _} -> - unimplemented () - | A.SubscriptVar {var=_; exp=_; _} -> - unimplemented () - ) end open Semant