Acutis_internals.Typechecker
Type-checks the untyped Ast.t
and constructs a typed tree.
module Type : sig ... end
Manages the type definitions.
type scalar_sum =
| Scalar_sum_none
| Scalar_sum_int of set_int Type.sum
| Scalar_sum_string of set_string Type.sum
type union_tag =
| Union_tag_none
| Union_tag_int of string * int * Type.sum_union_int
| Union_tag_string of string * string * Type.sum_union_string
type _ pat =
| Scalar : scalar * scalar_sum -> 'a pat
| Nil : 'a pat
| Cons : 'a pat -> 'a pat
| Tuple : 'a pat list -> 'a pat
| Record : union_tag * 'a pat map_string * Type.record -> 'a pat
| Dict : 'a pat map_string * set_string Stdlib.ref -> 'a pat
| Var : string -> 'a pat
| Block : nodes -> [ `Construct ] pat
| Field : [ `Construct ] pat * string -> [ `Construct ] pat
| Any : [ `Destruct ] pat
We use a GADT to prove that certain patterns may only appear when constructing and certain patterns may only appear when destructuring.
and node =
| Text of string * Ast.trim * Ast.trim
| Echo of (Ast.echo_format * echo) list * Ast.echo_format * echo * Ast.escape
| Match of Loc.t
* [ `Construct ] pat Nonempty.t
* Type.t Nonempty.t
* case Nonempty.t
| Map_list of Loc.t * [ `Construct ] pat * Type.t Nonempty.t * case Nonempty.t
| Map_dict of Loc.t * [ `Construct ] pat * Type.t Nonempty.t * case Nonempty.t
| Component of string * [ `Construct ] pat map_string
and case = {
pats : (Loc.t * [ `Destruct ] pat Nonempty.t) Nonempty.t;
bindings : string list;
The binding list is needed to help produce runtime instructions.
*)nodes : nodes;
}
and nodes = node list
val make_components :
(Ast.t, 'a) source map_string ->
(t, 'a) source map_string
val make : root:string -> (t, 'a) source map_string -> Ast.t -> t
val make_interface_standalone : Ast.interface -> Type.scheme