Commit | Line | Data |
---|---|---|
7f918cf1 CE |
1 | (* Copyright (C) 2009,2012,2015,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. | |
5 | * | |
6 | * MLton is released under a BSD-style license. | |
7 | * See the file MLton-LICENSE for details. | |
8 | *) | |
9 | ||
10 | signature AST_CORE_STRUCTS = | |
11 | sig | |
12 | include AST_ATOMS | |
13 | end | |
14 | ||
15 | signature AST_CORE = | |
16 | sig | |
17 | include AST_CORE_STRUCTS | |
18 | ||
19 | structure Fixity: | |
20 | sig | |
21 | datatype t = | |
22 | Infix of int option | |
23 | | Infixr of int option | |
24 | | Nonfix | |
25 | val layout: t -> Layout.t | |
26 | end | |
27 | ||
28 | structure Fixop: | |
29 | sig | |
30 | datatype t = Op | None | |
31 | end | |
32 | ||
33 | structure Pat: | |
34 | sig | |
35 | type t | |
36 | ||
37 | structure Item: | |
38 | sig | |
39 | type pat | |
40 | datatype t = | |
41 | Field of pat | |
42 | | Vid of Vid.t * Type.t option * pat option | |
43 | (* vid <:ty> <as pat> *) | |
44 | end | |
45 | sharing type Item.pat = t | |
46 | ||
47 | datatype node = | |
48 | App of Longcon.t * t | |
49 | | Const of Const.t | |
50 | | Constraint of t * Type.t | |
51 | | FlatApp of t vector | |
52 | | Layered of {constraint: Type.t option, | |
53 | fixop: Fixop.t, | |
54 | pat: t, | |
55 | var: Var.t} | |
56 | | List of t vector | |
57 | | Paren of t | |
58 | | Or of t vector | |
59 | | Record of {flexible: bool, | |
60 | items: (Record.Field.t * Region.t * Item.t) vector} | |
61 | | Tuple of t vector | |
62 | | Var of {fixop: Fixop.t, | |
63 | name: Longvid.t} | |
64 | | Vector of t vector | |
65 | | Wild | |
66 | ||
67 | include WRAPPED sharing type node' = node | |
68 | sharing type obj = t | |
69 | ||
70 | val constraint: t * Type.t -> t | |
71 | val layered: {fixop: Fixop.t, | |
72 | var: Var.t, | |
73 | constraint: Type.t option, | |
74 | pat: t} -> t | |
75 | val layout: t -> Layout.t | |
76 | val layoutFlatApp: t vector -> Layout.t | |
77 | val longvid: Longvid.t -> t | |
78 | val tuple: t vector -> t | |
79 | val var: Var.t -> t | |
80 | val wild: t | |
81 | end | |
82 | ||
83 | structure PrimKind: | |
84 | sig | |
85 | structure ImportExportAttribute: | |
86 | sig | |
87 | datatype t = Cdecl | External | Impure | Private | Public | Pure | Reentrant | Runtime | Stdcall | |
88 | ||
89 | val layout: t -> Layout.t | |
90 | end | |
91 | ||
92 | structure SymbolAttribute: | |
93 | sig | |
94 | datatype t = Alloc | External | Private | Public | |
95 | ||
96 | val layout: t -> Layout.t | |
97 | end | |
98 | ||
99 | datatype t = | |
100 | Address of {attributes: SymbolAttribute.t list, | |
101 | name: string, | |
102 | ty: Type.t} | |
103 | | BuildConst of {name: string, | |
104 | ty: Type.t} | |
105 | | CommandLineConst of {name: string, | |
106 | ty: Type.t, | |
107 | value: Const.t} | |
108 | | Const of {name: string, | |
109 | ty: Type.t} | |
110 | | Export of {attributes: ImportExportAttribute.t list, | |
111 | name: string, | |
112 | ty: Type.t} | |
113 | | IImport of {attributes: ImportExportAttribute.t list, | |
114 | ty: Type.t} | |
115 | | Import of {attributes: ImportExportAttribute.t list, | |
116 | name: string, | |
117 | ty: Type.t} | |
118 | | ISymbol of {ty: Type.t} | |
119 | | Prim of {name: string, | |
120 | ty: Type.t} | |
121 | | Symbol of {attributes: SymbolAttribute.t list, | |
122 | name: string, | |
123 | ty: Type.t} | |
124 | end | |
125 | ||
126 | structure Priority: | |
127 | sig | |
128 | datatype t = T of int option | |
129 | val <= : t * t -> bool | |
130 | val default: t | |
131 | val layout: t -> Layout.t | |
132 | end | |
133 | ||
134 | structure Exp: | |
135 | sig | |
136 | type dec | |
137 | type match | |
138 | type t | |
139 | datatype node = | |
140 | Andalso of t * t | |
141 | | App of t * t | |
142 | | Case of t * match | |
143 | | Const of Const.t | |
144 | | Constraint of t * Type.t | |
145 | | FlatApp of t vector | |
146 | | Fn of match | |
147 | | Handle of t * match | |
148 | | If of t * t * t | |
149 | | Let of dec * t | |
150 | | List of t vector | |
151 | | Orelse of t * t | |
152 | | Paren of t | |
153 | | Prim of PrimKind.t | |
154 | | Raise of t | |
155 | | Record of (Region.t * t) Record.t | |
156 | | Selector of Record.Field.t | |
157 | | Seq of t vector | |
158 | | Var of {fixop: Fixop.t, | |
159 | name: Longvid.t} | |
160 | | Vector of t vector | |
161 | | While of {expr: t, | |
162 | test: t} | |
163 | ||
164 | include WRAPPED sharing type node' = node | |
165 | sharing type obj = t | |
166 | ||
167 | val app: t * t -> t | |
168 | val const: Const.t -> t | |
169 | val constraint: t * Type.t -> t | |
170 | val fnn: (Pat.t * t) vector -> t | |
171 | val layout: t -> Layout.t | |
172 | val lett: dec vector * t * Region.t -> t | |
173 | val longvid: Longvid.t -> t | |
174 | val tuple: t vector -> t | |
175 | val unit: t | |
176 | val var: Var.t -> t | |
177 | end | |
178 | ||
179 | structure Match: | |
180 | sig | |
181 | type t | |
182 | datatype node = T of (Pat.t * Exp.t) vector | |
183 | include WRAPPED sharing type node' = node | |
184 | sharing type obj = t | |
185 | val layout : t -> Layout.t | |
186 | val layoutRule : Pat.t * Exp.t -> Layout.t | |
187 | end | |
188 | sharing type Exp.match = Match.t | |
189 | ||
190 | structure EbRhs: | |
191 | sig | |
192 | type t | |
193 | datatype node = | |
194 | Def of Longcon.t | |
195 | | Gen of Type.t option | |
196 | include WRAPPED sharing type node' = node | |
197 | sharing type obj = t | |
198 | end | |
199 | ||
200 | structure Dec: | |
201 | sig | |
202 | type t | |
203 | datatype node = | |
204 | Abstype of {datBind: DatBind.t, | |
205 | body: t} | |
206 | | Datatype of DatatypeRhs.t | |
207 | | DoDec of Exp.t | |
208 | | Exception of (Con.t * EbRhs.t) vector | |
209 | | Fix of {fixity: Fixity.t, | |
210 | ops: Vid.t vector} | |
211 | | Fun of {tyvars: Tyvar.t vector, | |
212 | fbs: {body: Exp.t, | |
213 | pats: Pat.t vector, | |
214 | resultType: Type.t option} vector vector} | |
215 | | Local of t * t | |
216 | | Open of Longstrid.t vector | |
217 | | Overload of Priority.t * | |
218 | Var.t * | |
219 | Tyvar.t vector * Type.t * | |
220 | Longvid.t vector | |
221 | | SeqDec of t vector | |
222 | | Type of TypBind.t | |
223 | | Val of {rvbs: {match: Match.t, | |
224 | pat: Pat.t} vector, | |
225 | tyvars: Tyvar.t vector, | |
226 | vbs: {exp: Exp.t, | |
227 | pat: Pat.t} vector} | |
228 | include WRAPPED sharing type node' = node | |
229 | sharing type obj = t | |
230 | ||
231 | val checkSyntax: t -> unit | |
232 | val fromExp: Exp.t -> t | |
233 | val layout: t -> Layout.t | |
234 | val layoutFun: | |
235 | {tyvars: Tyvar.t vector, | |
236 | fbs: {body: Exp.t, | |
237 | pats: Pat.t vector, | |
238 | resultType: Type.t option} vector vector} | |
239 | -> (unit -> Layout.t) vector | |
240 | val layoutVal: | |
241 | {rvbs: {match: Match.t, | |
242 | pat: Pat.t} vector, | |
243 | tyvars: Tyvar.t vector, | |
244 | vbs: {exp: Exp.t, | |
245 | pat: Pat.t} vector} | |
246 | -> {rvbs: (unit -> Layout.t) vector, | |
247 | vbs: (unit -> Layout.t) vector} | |
248 | val openn: Longstrid.t vector -> t | |
249 | val vall: Tyvar.t vector * Var.t * Exp.t -> t | |
250 | end | |
251 | sharing type Dec.t = Exp.dec | |
252 | end |