annotate src/core.sml @ 74:144d082b47ae

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