adamc@26: (* Copyright (c) 2008, Adam Chlipala adamc@26: * All rights reserved. adamc@26: * adamc@26: * Redistribution and use in source and binary forms, with or without adamc@26: * modification, are permitted provided that the following conditions are met: adamc@26: * adamc@26: * - Redistributions of source code must retain the above copyright notice, adamc@26: * this list of conditions and the following disclaimer. adamc@26: * - Redistributions in binary form must reproduce the above copyright notice, adamc@26: * this list of conditions and the following disclaimer in the documentation adamc@26: * and/or other materials provided with the distribution. adamc@26: * - The names of contributors may not be used to endorse or promote products adamc@26: * derived from this software without specific prior written permission. adamc@26: * adamc@26: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" adamc@26: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE adamc@26: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE adamc@26: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE adamc@26: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR adamc@26: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF adamc@26: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS adamc@26: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN adamc@26: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) adamc@26: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE adamc@26: * POSSIBILITY OF SUCH DAMAGE. adamc@26: *) adamc@26: adamc@26: structure Flat = struct adamc@26: adamc@26: type 'a located = 'a ErrorMsg.located adamc@26: adamc@26: datatype typ' = adamc@29: TTop adamc@29: | TFun of typ * typ adamc@26: | TCode of typ * typ adamc@26: | TRecord of (string * typ) list adamc@26: | TNamed of int adamc@52: | TFfi of string * string adamc@26: adamc@26: withtype typ = typ' located adamc@26: adamc@26: datatype exp' = adamc@26: EPrim of Prim.t adamc@26: | ERel of int adamc@26: | ENamed of int adamc@52: | EFfi of string * string adamc@52: | EFfiApp of string * string * exp list adamc@26: | ECode of int adamc@26: | EApp of exp * exp adamc@26: adamc@29: | ERecord of (string * exp * typ) list adamc@26: | EField of exp * string adamc@26: adamc@29: | ELet of (string * typ * exp) list * exp adamc@26: adamc@26: withtype exp = exp' located adamc@26: adamc@26: datatype decl' = adamc@26: DVal of string * int * typ * exp adamc@26: | DFun of int * string * typ * typ * exp adamc@26: adamc@26: withtype decl = decl' located adamc@26: adamc@26: type file = decl list adamc@26: adamc@26: end