+ and transDec ~env dec =
+ (match dec with
+ | A.VarDec {name; typ=typ_opt; init; pos=pos_outter; escape=_} ->
+ let ty =
+ (match (typ_opt, transExp ~env init) with
+ | None, {ty; exp=()} ->
+ ty
+ | Some (sym, pos_inner), expty_init ->
+ let ty = env_get_typ ~sym ~env ~pos:pos_inner in
+ check_same {exp=(); ty} expty_init ~pos:pos_outter;
+ ty
+ )
+ in
+ Env.set_val env name (Value.Var {ty})
+ | A.TypeDecs _ ->
+ unimplemented ()
+ | A.FunDecs _ ->
+ unimplemented ()
+ )