Module Lam

type apply_status =
  1. | App_na
  2. | App_infer_full
  3. | App_uncurry
type ident = Ident.t
type lambda_switch = {
  1. sw_consts_full : bool;
  2. sw_consts : (int * t) list;
  3. sw_blocks_full : bool;
  4. sw_blocks : (int * t) list;
  5. sw_failaction : t option;
  6. sw_names : Melange_compiler_libs.Lambda.switch_names option;
}
and apply = private {
  1. ap_func : t;
  2. ap_args : t list;
  3. ap_info : ap_info;
}
and lfunction = {
  1. arity : int;
  2. params : ident list;
  3. body : t;
  4. attr : Melange_compiler_libs.Lambda.function_attribute;
}
and prim_info = private {
  1. primitive : Lam_primitive.t;
  2. args : t list;
  3. loc : Melange_compiler_libs.Location.t;
}
and t = private
  1. | Lvar of ident
  2. | Lmutvar of ident
  3. | Lglobal_module of ident
  4. | Lconst of Lam_constant.t
  5. | Lapply of apply
  6. | Lfunction of lfunction
  7. | Llet of Lam_compat.let_kind * ident * t * t
  8. | Lmutlet of ident * t * t
  9. | Lletrec of (ident * t) list * t
  10. | Lprim of prim_info
  11. | Lswitch of t * lambda_switch
  12. | Lstringswitch of t * (string * t) list * t option
  13. | Lstaticraise of int * t list
  14. | Lstaticcatch of t * int * ident list * t
  15. | Ltrywith of t * ident * t
  16. | Lifthenelse of t * t * t
  17. | Lsequence of t * t
  18. | Lwhile of t * t
  19. | Lfor of ident * t * t * Asttypes.direction_flag * t
  20. | Lassign of ident * t
  21. | Lsend of Melange_compiler_libs.Lambda.meth_kind * t * t * t list * Melange_compiler_libs.Location.t
  22. | Lifused of ident * t
val inner_map : t -> (t -> t) -> t
val var : ident -> t

Smart constructors

val mutvar : ident -> t
val global_module : ident -> t
val const : Lam_constant.t -> t
val apply : t -> t list -> ap_info -> t
val function_ : attr:Melange_compiler_libs.Lambda.function_attribute -> arity:int -> params:ident list -> body:t -> t
val let_ : Lam_compat.let_kind -> ident -> t -> t -> t
val mutlet : ident -> t -> t -> t
val letrec : (ident * t) list -> t -> t
val if_ : t -> t -> t -> t

constant folding

val switch : t -> lambda_switch -> t

constant folding

val stringswitch : t -> (string * t) list -> t option -> t

constant folding

val false_ : t
val unit : t
val sequor : t -> t -> t

convert l || r to if l then true else r

val sequand : t -> t -> t

convert l && r to if l then r else false

constant folding

val seq : t -> t -> t

drop unused block

val while_ : t -> t -> t
val try_ : t -> ident -> t -> t
val ifused : ident -> t -> t
val assign : ident -> t -> t
val prim : primitive:Lam_primitive.t -> args:t list -> Melange_compiler_libs.Location.t -> t

constant folding

val staticcatch : t -> (int * ident list) -> t -> t
val staticraise : int -> t list -> t
val for_ : ident -> t -> t -> Asttypes.direction_flag -> t -> t
val eq_approx : t -> t -> bool