annotate src/expl.sml @ 166:a991431b77eb

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