1 (* Copyright (C) 2009,2017 Matthew Fluet.
2 * Copyright (C) 1999-2008 Henry Cejtin, Matthew Fluet, Suresh
3 * Jagannathan, and Stephen Weeks.
4 * Copyright (C) 1997-2000 NEC Research Institute.
6 * MLton is released under a BSD-style license.
7 * See the file MLton-LICENSE for details.
10 (* binding occurences:
19 signature XML_TREE_STRUCTS =
26 include XML_TREE_STRUCTS
28 structure Type: XML_TYPE
29 sharing Atoms = Type.Atoms
33 datatype t = T of {arg: (Var.t * Type.t) option,
40 val layout: t -> Layout.t
46 Con of (Pat.t * 'a) vector
47 | Word of WordSize.t * (WordX.t * 'a) vector
49 val fold: 'a t * 'b * ('a * 'b -> 'b) -> 'b
50 val foreach: 'a t * ('a -> unit) -> unit
51 val foreach': 'a t * ('a -> unit) * (Pat.t -> unit) -> unit
52 val map: 'a t * ('a -> 'b) -> 'b t
62 val dest: t -> {arg: Var.t,
66 val equals: t * t -> bool
67 val layout: t -> Layout.t
68 val make: {arg: Var.t,
72 val mayInline: t -> bool
73 val plist: t -> PropertyList.t
76 (* VarExp is a type application, variable applied to type args. *)
79 datatype t = T of {var: Var.t,
82 val equals: t * t -> bool
83 val layout: t -> Layout.t
92 App of {arg: VarExp.t,
94 | Case of {cases: exp Cases.t,
95 default: (exp * Region.t) option,
97 | ConApp of {arg: VarExp.t option,
101 | Handle of {(* catch binds the exception in the handler. *)
102 catch: Var.t * Type.t,
106 | PrimApp of {args: VarExp.t vector,
108 targs: Type.t vector}
109 | Profile of ProfileExp.t
110 | Raise of {exn: VarExp.t, extend: bool}
111 | Select of {offset: int,
113 | Tuple of VarExp.t vector
116 val layout: t -> Layout.t
121 type exp = Lambda.exp
124 Exception of {arg: Type.t option,
126 | Fun of {decs: {lambda: Lambda.t,
129 tyvars: Tyvar.t vector}
130 | MonoVal of {exp: PrimExp.t,
133 | PolyVal of {exp: exp,
135 tyvars: Tyvar.t vector,
138 val layout: t -> Layout.t
146 val decs: t -> Dec.t list
147 val dest: t -> {decs: Dec.t list, result: VarExp.t}
148 val enterLeave: t * Type.t * SourceInfo.t -> t
149 (* foreach {exp, handleExp, handleBoundVar, handleVarExp}
150 * applies handleExp to each subexpresison of e (including e)
151 * applies handleBoundVar to each variable bound in e
152 * applies handleVarExp to each variable expression in e
153 * handleBoundVar will be called on a variable binding before
154 * handleVarExp is called on any occurrences
155 * handleExp is called on an expression after it is called on
156 * all of its subexpressions
160 handleExp: t -> unit,
161 handlePrimExp: Var.t * Type.t * PrimExp.t -> unit,
162 handleBoundVar: Var.t * Tyvar.t vector * Type.t -> unit,
163 handleVarExp: VarExp.t -> unit} -> unit
165 t * (Var.t * Tyvar.t vector * Type.t -> unit) -> unit
166 val foreachExp: t * (t -> unit) -> unit
167 val foreachPrimExp: t * (Var.t * Type.t * PrimExp.t -> unit) -> unit
168 val foreachVarExp: t * (VarExp.t -> unit) -> unit
169 val fromPrimExp: PrimExp.t * Type.t -> t
170 val hasPrim: t * (Type.t Prim.t -> bool) -> bool
171 val layout: t -> Layout.t
172 val make: {decs: Dec.t list, result: VarExp.t} -> t
173 val prefix: t * Dec.t -> t
174 val result: t -> VarExp.t
182 val app: {func: t, arg: t, ty: Type.t} -> t
186 default: (t * Region.t) option,
188 ty: Type.t} (* type of entire case expression *)
190 val conApp: {arg: t option,
192 targs: Type.t vector,
194 val const: Const.t -> t
196 val detuple: {tuple: t, body: (VarExp.t * Type.t) vector -> t} -> t
197 val detupleBind: {tuple: t, components: Var.t vector, body: t} -> t
198 val devector: {vector: t, length: int, body: (VarExp.t * Type.t) vector -> t} -> t
199 val equal: t * t -> t
200 val falsee: unit -> t
201 val fromExp: Exp.t * Type.t -> t
202 val fromLambda: Lambda.t * Type.t -> t
203 val handlee: {catch: Var.t * Type.t,
207 val iff: {test: t, thenn: t, elsee: t, ty: Type.t} -> t
208 val lambda: {arg: Var.t,
212 mayInline: bool} -> t
213 val let1: {var: Var.t, exp: t, body: t} -> t
214 val lett: {decs: Dec.t list, body: t} -> t
215 val monoVar: Var.t * Type.t -> t
216 val primApp: {args: t vector,
218 targs: Type.t vector,
220 val raisee: {exn: t, extend: bool, ty: Type.t} -> t
222 val select: {tuple: t, offset: int, ty: Type.t} -> t
223 val seq: t vector * (t vector -> t) -> t
224 val sequence: t vector -> t
225 val string: string -> t
226 val toExp: t -> Exp.t
228 val tuple: {exps: t vector, ty: Type.t} -> t
230 val vall: {var: Var.t, exp: t} -> Dec.t list
231 val var: {targs: Type.t vector,
234 val varExp: VarExp.t * Type.t -> t
235 val vectorLength: t -> t
242 datatypes: {cons: {arg: Type.t option,
245 tyvars: Tyvar.t vector} vector,
246 (* overflow is SOME only after exceptions have been
249 overflow: Var.t option}
251 val clear: t -> unit (* clear all property lists *)
252 val layout: t -> Layout.t
253 val layouts: t * (Layout.t -> unit) -> unit
254 val layoutStats: t -> Layout.t