adamc@0: (* Copyright (c) 2008, Adam Chlipala adamc@0: * All rights reserved. adamc@0: * adamc@0: * Redistribution and use in source and binary forms, with or without adamc@0: * modification, are permitted provided that the following conditions are met: adamc@0: * adamc@0: * - Redistributions of source code must retain the above copyright notice, adamc@0: * this list of conditions and the following disclaimer. adamc@0: * - Redistributions in binary form must reproduce the above copyright notice, adamc@0: * this list of conditions and the following disclaimer in the documentation adamc@0: * and/or other materials provided with the distribution. adamc@0: * - The names of contributors may not be used to endorse or promote products adamc@0: * derived from this software without specific prior written permission. adamc@0: * adamc@0: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" adamc@0: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE adamc@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE adamc@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE adamc@0: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR adamc@0: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF adamc@0: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS adamc@0: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN adamc@0: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) adamc@0: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE adamc@0: * POSSIBILITY OF SUCH DAMAGE. adamc@0: *) adamc@0: adamc@4: structure Source = struct adamc@0: adamc@0: type 'a located = 'a ErrorMsg.located adamc@0: adamc@0: datatype kind' = adamc@0: KType adamc@0: | KArrow of kind * kind adamc@0: | KName adamc@0: | KRecord of kind adamc@82: | KUnit adamc@18: | KWild adamc@0: adamc@0: withtype kind = kind' located adamc@0: adamc@1: datatype explicitness = adamc@1: Explicit adamc@1: | Implicit adamc@1: adamc@0: datatype con' = adamc@0: CAnnot of con * kind adamc@0: adamc@0: | TFun of con * con adamc@1: | TCFun of explicitness * string * kind * con adamc@85: | TDisjoint of con * con * con adamc@0: | TRecord of con adamc@0: adamc@34: | CVar of string list * string adamc@0: | CApp of con * con adamc@67: | CAbs of string * kind option * con adamc@84: | CDisjoint of con * con * con adamc@0: adamc@0: | CName of string adamc@0: adamc@1: | CRecord of (con * con) list adamc@0: | CConcat of con * con adamc@67: | CFold adamc@0: adamc@82: | CUnit adamc@82: adamc@18: | CWild of kind adamc@18: adamc@0: withtype con = con' located adamc@0: adamc@30: datatype sgn_item' = adamc@30: SgiConAbs of string * kind adamc@30: | SgiCon of string * kind option * con adamc@30: | SgiVal of string * con adamc@30: | SgiStr of string * sgn adamc@59: | SgiSgn of string * sgn adamc@58: | SgiInclude of sgn adamc@88: | SgiConstraint of con * con adamc@30: adamc@30: and sgn' = adamc@30: SgnConst of sgn_item list adamc@30: | SgnVar of string adamc@40: | SgnFun of string * sgn * sgn adamc@42: | SgnWhere of sgn * string * con adamc@59: | SgnProj of string * string list * string adamc@30: adamc@30: withtype sgn_item = sgn_item' located adamc@30: and sgn = sgn' located adamc@30: adamc@34: datatype exp' = adamc@34: EAnnot of exp * con adamc@34: adamc@34: | EPrim of Prim.t adamc@34: | EVar of string list * string adamc@34: | EApp of exp * exp adamc@34: | EAbs of string * con option * exp adamc@34: | ECApp of exp * con adamc@34: | ECAbs of explicitness * string * kind * exp adamc@85: | EDisjoint of con * con * exp adamc@34: adamc@34: | ERecord of (con * exp) list adamc@34: | EField of exp * con adamc@71: | EFold adamc@34: adamc@34: withtype exp = exp' located adamc@34: adamc@1: datatype decl' = adamc@1: DCon of string * kind option * con adamc@8: | DVal of string * con option * exp adamc@30: | DSgn of string * sgn adamc@30: | DStr of string * sgn option * str adamc@48: | DFfiStr of string * sgn adamc@61: | DOpen of string * string list adamc@88: | DConstraint of con * con adamc@88: | DOpenConstraints of string * string list adamc@109: | DExport of str adamc@30: adamc@30: and str' = adamc@30: StrConst of decl list adamc@30: | StrVar of string adamc@34: | StrProj of str * string adamc@40: | StrFun of string * sgn * sgn option * str adamc@44: | StrApp of str * str adamc@1: adamc@1: withtype decl = decl' located adamc@30: and str = str' located adamc@1: adamc@1: type file = decl list adamc@1: adamc@0: end