Mercurial > urweb
comparison src/expl.sml @ 38:d16ef24de78b
Explify
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 19 Jun 2008 10:06:59 -0400 |
parents | |
children | 3c1ce1b4eb3d |
comparison
equal
deleted
inserted
replaced
37:367f058aba23 | 38:d16ef24de78b |
---|---|
1 (* Copyright (c) 2008, Adam Chlipala | |
2 * All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions are met: | |
6 * | |
7 * - Redistributions of source code must retain the above copyright notice, | |
8 * this list of conditions and the following disclaimer. | |
9 * - Redistributions in binary form must reproduce the above copyright notice, | |
10 * this list of conditions and the following disclaimer in the documentation | |
11 * and/or other materials provided with the distribution. | |
12 * - The names of contributors may not be used to endorse or promote products | |
13 * derived from this software without specific prior written permission. | |
14 * | |
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | |
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
25 * POSSIBILITY OF SUCH DAMAGE. | |
26 *) | |
27 | |
28 structure Expl = struct | |
29 | |
30 type 'a located = 'a ErrorMsg.located | |
31 | |
32 datatype kind' = | |
33 KType | |
34 | KArrow of kind * kind | |
35 | KName | |
36 | KRecord of kind | |
37 | |
38 withtype kind = kind' located | |
39 | |
40 datatype con' = | |
41 TFun of con * con | |
42 | TCFun of string * kind * con | |
43 | TRecord of con | |
44 | |
45 | CRel of int | |
46 | CNamed of int | |
47 | CModProj of int * string list * string | |
48 | CApp of con * con | |
49 | CAbs of string * kind * con | |
50 | |
51 | CName of string | |
52 | |
53 | CRecord of kind * (con * con) list | |
54 | CConcat of con * con | |
55 | |
56 withtype con = con' located | |
57 | |
58 datatype exp' = | |
59 EPrim of Prim.t | |
60 | ERel of int | |
61 | ENamed of int | |
62 | EModProj of int * string list * string | |
63 | EApp of exp * exp | |
64 | EAbs of string * con * con * exp | |
65 | ECApp of exp * con | |
66 | ECAbs of string * kind * exp | |
67 | |
68 | ERecord of (con * exp * con) list | |
69 | EField of exp * con * { field : con, rest : con } | |
70 | |
71 withtype exp = exp' located | |
72 | |
73 datatype sgn_item' = | |
74 SgiConAbs of string * int * kind | |
75 | SgiCon of string * int * kind * con | |
76 | SgiVal of string * int * con | |
77 | SgiStr of string * int * sgn | |
78 | |
79 and sgn' = | |
80 SgnConst of sgn_item list | |
81 | SgnVar of int | |
82 | |
83 withtype sgn_item = sgn_item' located | |
84 and sgn = sgn' located | |
85 | |
86 datatype decl' = | |
87 DCon of string * int * kind * con | |
88 | DVal of string * int * con * exp | |
89 | DSgn of string * int * sgn | |
90 | DStr of string * int * sgn * str | |
91 | |
92 and str' = | |
93 StrConst of decl list | |
94 | StrVar of int | |
95 | StrProj of str * string | |
96 | |
97 withtype decl = decl' located | |
98 and str = str' located | |
99 | |
100 type file = decl list | |
101 | |
102 end |