Module Mlsem_lang.MAst

module SA = Mlsem_system.Ast
type e =
  1. | Hole of int
  2. | Exc
    (*

    Expression of type empty

    *)
  3. | Void
    (*

    Expression of type void

    *)
  4. | Voidify of t
    (*

    Evaluate the expression inside, but give it the void type, even if it diverges

    *)
  5. | Value of Mlsem_types.GTy.t
  6. | Var of Mlsem_common.Variable.t
  7. | Constructor of SA.constructor * t list
  8. | Lambda of Mlsem_types.Ty.t list * Mlsem_types.GTy.t * Mlsem_common.Variable.t * t
    (*

    The first parameter is a suggested type decomposition, similarly to let-bindings

    *)
  9. | LambdaRec of (Mlsem_types.GTy.t * Mlsem_common.Variable.t * t) list
  10. | Ite of t * Mlsem_types.GTy.t * t * t
  11. | App of t * t
  12. | Operation of SA.operation * t
  13. | Projection of SA.projection * t
  14. | Declare of Mlsem_common.Variable.t * t
    (*

    Declaration of an uninitialized mutable variable. The variable provided must be mutable (cf. MVariable.create). The type system will not check that the variable is assigned before use.

    *)
  15. | Let of Mlsem_types.Ty.t list * Mlsem_common.Variable.t * t * t
    (*

    The first parameter is a suggested type decomposition

    *)
  16. | TypeCast of t * Mlsem_types.GTy.t * SA.check
  17. | TypeCoerce of t * Mlsem_types.GTy.t * SA.check
  18. | VarAssign of Mlsem_common.Variable.t * t
    (*

    The variable provided must be mutable (cf. MVariable.create)

    *)
  19. | Loop of t
    (*

    An expression that may be evaluated multiple times. Used to encode While expressions.

    *)
  20. | Seq of t * t
    (*

    Evaluate the first expression, then the second.

    *)
  21. | Try of t * t
    (*

    May jump from a branch to another. Used to model try-with expressions.

    *)
  22. | Alt of t * t
    (*

    Evaluate both branches independently. The result is (the intersection of) the result of the branches that do not fail.

    *)
val map : (t -> t) -> t -> t
val map' : (t -> t option) -> t -> t
val iter : (t -> unit) -> t -> unit
val iter' : (t -> bool) -> t -> unit
val fill_hole : int -> t -> t -> t
val fv : t -> Mlsem_common.VarSet.t
val vars : t -> Mlsem_common.VarSet.t
val to_system_ast : t -> SA.t
val pp_e : Stdlib.Format.formatter -> e -> unit
val pp : Stdlib.Format.formatter -> t -> unit