Module Typing.Typechecking

typecheck ?event_env program typechecks the program by ensuring that:

  • All event expressions are well-typed according to the event_env.
  • Template instance expressions are well-typed according to the event_env and expr_env.
  • All relations find their corresponding events in the event_env.
  • parameter event_env

    The environment of events to typecheck against.

  • parameter program

    The program to typecheck.

  • returns

    A result containing the type environment and event environment if the program is well-typed, or a list of errors if the program is not well-typed.

val typecheck_expr : ?ty_env:Ast.Syntax.type_expr' Common.Env.env -> ?label_types:Helper.event_type_value Stdlib.Hashtbl.Make(Stdlib.String).t -> Ast.Syntax.expr -> (Ast.Syntax.type_expr', Ast.Error.detailed_error list) Stdlib.result

typecheck_expr ?ty_env ?label_types expr typechecks the expr by ensuring that:

  • All expressions are well-typed according to the ty_env.
  • All event expressions are well-typed according to the label_types.
  • parameter ty_env

    The environment of types to typecheck against.

  • parameter label_types

    The environment of event types to typecheck against.

  • parameter expr

    The expression to typecheck.

  • returns

    A result containing the type of the expression if the expression is well-typed, or a list of errors if the expression is not well-typed.

val equal_types : Ast.Syntax.type_expr' -> Ast.Syntax.type_expr' -> bool

(tail recursive) equal_types type_1 type_2 indicates whether type expressions type_1 and type_2 are structurally equal .

Returns true if the type_1 and type_2 are structurally equal, and false otherwise.