Import Upstream version 20180207
[hcoop/debian/mlton.git] / mlton / match-compile / match-compile.sig
CommitLineData
7f918cf1
CE
1(* Copyright (C) 2009,2015,2017 Matthew Fluet.
2 * Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
3 * Jagannathan, and Stephen Weeks.
4 * Copyright (C) 1997-2000 NEC Research Institute.
5 *
6 * MLton is released under a BSD-style license.
7 * See the file MLton-LICENSE for details.
8 *)
9
10signature MATCH_COMPILE_STRUCTS =
11 sig
12 include ATOMS
13 structure Type:
14 sig
15 type t
16
17 val deTuple: t -> t vector
18 val equals: t * t -> bool
19 val layout: t -> Layout.t
20 val unit: t
21 val word: WordSize.t -> t
22 end
23 structure Cases:
24 sig
25 type exp
26 type t
27
28 val con: {arg: (Var.t * Type.t) option,
29 con: Con.t,
30 rhs: exp,
31 targs: Type.t vector} vector -> t
32 val word: WordSize.t * (WordX.t * exp) vector -> t
33 end
34 structure Exp:
35 sig
36 type t
37
38 val casee:
39 {cases: Cases.t,
40 default: (t * Region.t) option,
41 test: t,
42 ty: Type.t} (* type of entire case expression *)
43 -> t
44 val const: Const.t -> t
45 val deref: t -> t
46 val detuple: {tuple: t,
47 body: (Var.t * Type.t) vector -> t} -> t
48 val devector: {vector: t, length: int,
49 body: (Var.t * Type.t) vector -> t} -> t
50 val equal: t * t -> t
51 val iff: {test: t, thenn: t, elsee: t, ty: Type.t} -> t
52 val lett: {var: Var.t, exp: t, body: t} -> t
53 val var: Var.t * Type.t -> t
54 val vectorLength: t -> t
55 end
56 sharing type Cases.exp = Exp.t
57 structure NestedPat: NESTED_PAT
58 sharing Atoms = NestedPat.Atoms
59 sharing Type = NestedPat.Type
60 end
61
62signature MATCH_COMPILE =
63 sig
64 include MATCH_COMPILE_STRUCTS
65
66 val matchCompile:
67 {caseType: Type.t, (* type of entire expression *)
68 cases: (NestedPat.t * (int -> (Var.t -> Var.t) -> Exp.t)) vector,
69 conTycon: Con.t -> Tycon.t,
70 region: Region.t,
71 test: Var.t,
72 testType: Type.t,
73 tyconCons: Tycon.t -> {con: Con.t, hasArg: bool} vector}
74 -> Exp.t * ({dropOnlyExns: bool} -> Layout.t option)
75 end