From 95beeda12defe36c4d4df42d3dee3bd753e19ff5 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sat, 26 Jan 2008 15:29:09 -0500 Subject: Rename Laconic* modules to Source* --- src/compiler.sig | 2 +- src/compiler.sml | 2 +- src/elaborate.sig | 2 +- src/elaborate.sml | 2 +- src/laconic.sml | 69 ------------------------ src/laconic_print.sig | 36 ------------- src/laconic_print.sml | 147 -------------------------------------------------- src/lacweb.grm | 2 +- src/source.sml | 69 ++++++++++++++++++++++++ src/source_print.sig | 36 +++++++++++++ src/source_print.sml | 147 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/sources | 6 +-- 12 files changed, 260 insertions(+), 260 deletions(-) delete mode 100644 src/laconic.sml delete mode 100644 src/laconic_print.sig delete mode 100644 src/laconic_print.sml create mode 100644 src/source.sml create mode 100644 src/source_print.sig create mode 100644 src/source_print.sml (limited to 'src') diff --git a/src/compiler.sig b/src/compiler.sig index 92c4d679..ede5d8b5 100644 --- a/src/compiler.sig +++ b/src/compiler.sig @@ -29,7 +29,7 @@ signature COMPILER = sig - val parse : string -> Laconic.file option + val parse : string -> Source.file option val testParse : string -> unit diff --git a/src/compiler.sml b/src/compiler.sml index 2463528b..967fcf3d 100644 --- a/src/compiler.sml +++ b/src/compiler.sml @@ -58,7 +58,7 @@ fun testParse filename = if ErrorMsg.anyErrors () then print "Recoverable parse error\n" else - (Print.print (LaconicPrint.p_file file); + (Print.print (SourcePrint.p_file file); print "\n") end diff --git a/src/elaborate.sig b/src/elaborate.sig index 99fc9ebf..519e5689 100644 --- a/src/elaborate.sig +++ b/src/elaborate.sig @@ -27,6 +27,6 @@ signature ELABORATE = sig - val elabFile : Laconic.file -> Elab.file + val elabFile : Source.file -> Elab.file end diff --git a/src/elaborate.sml b/src/elaborate.sml index e6044e49..ed290d55 100644 --- a/src/elaborate.sml +++ b/src/elaborate.sml @@ -27,7 +27,7 @@ structure Elaborate :> ELABORATE = struct -structure L = Laconic +structure L = Source structure L' = Elab structure E = ElabEnv structure U = ElabUtil diff --git a/src/laconic.sml b/src/laconic.sml deleted file mode 100644 index 02770a75..00000000 --- a/src/laconic.sml +++ /dev/null @@ -1,69 +0,0 @@ -(* Copyright (c) 2008, Adam Chlipala - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - The names of contributors may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *) - -structure Laconic = struct - -type 'a located = 'a ErrorMsg.located - -datatype kind' = - KType - | KArrow of kind * kind - | KName - | KRecord of kind - -withtype kind = kind' located - -datatype explicitness = - Explicit - | Implicit - -datatype con' = - CAnnot of con * kind - - | TFun of con * con - | TCFun of explicitness * string * kind * con - | TRecord of con - - | CVar of string - | CApp of con * con - | CAbs of explicitness * string * kind * con - - | CName of string - - | CRecord of (con * con) list - | CConcat of con * con - -withtype con = con' located - -datatype decl' = - DCon of string * kind option * con - -withtype decl = decl' located - -type file = decl list - -end diff --git a/src/laconic_print.sig b/src/laconic_print.sig deleted file mode 100644 index 079b420e..00000000 --- a/src/laconic_print.sig +++ /dev/null @@ -1,36 +0,0 @@ -(* Copyright (c) 2008, Adam Chlipala - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - The names of contributors may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *) - -(* Pretty-printing Laconic/Web *) - -signature LACONIC_PRINT = sig - val p_kind : Laconic.kind Print.printer - val p_explicitness : Laconic.explicitness Print.printer - val p_con : Laconic.con Print.printer - val p_decl : Laconic.decl Print.printer - val p_file : Laconic.file Print.printer -end diff --git a/src/laconic_print.sml b/src/laconic_print.sml deleted file mode 100644 index 9b18dcba..00000000 --- a/src/laconic_print.sml +++ /dev/null @@ -1,147 +0,0 @@ -(* Copyright (c) 2008, Adam Chlipala - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - The names of contributors may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - *) - -(* Pretty-printing Laconic/Web *) - -structure LaconicPrint :> LACONIC_PRINT = struct - -open Print.PD -open Print - -open Laconic - -fun p_kind' par (k, _) = - case k of - KType => string "Type" - | KArrow (k1, k2) => parenIf par (box [p_kind' true k1, - space, - string "->", - space, - p_kind k2]) - | KName => string "Name" - | KRecord k => box [string "{", p_kind k, string "}"] - -and p_kind k = p_kind' false k - -fun p_explicitness e = - case e of - Explicit => string "::" - | Implicit => string ":::" - -fun p_con' par (c, _) = - case c of - CAnnot (c, k) => box [string "(", - p_con c, - space, - string "::", - space, - p_kind k, - string ")"] - - | TFun (t1, t2) => parenIf par (box [p_con' true t1, - space, - string "->", - space, - p_con t2]) - | TCFun (e, x, k, c) => parenIf par (box [string x, - space, - p_explicitness e, - space, - p_kind k, - space, - string "->", - space, - p_con c]) - | TRecord (CRecord xcs, _) => box [string "{", - p_list (fn (x, c) => - box [p_con x, - space, - string ":", - space, - p_con c]) xcs, - string "}"] - | TRecord c => box [string "$", - p_con' true c] - - | CVar s => string s - | CApp (c1, c2) => parenIf par (box [p_con c1, - space, - p_con' true c2]) - | CAbs (e, x, k, c) => parenIf par (box [string "fn", - space, - string x, - space, - p_explicitness e, - space, - p_kind k, - space, - string "=>", - space, - p_con c]) - - | CName s => box [string "#", string s] - - | CRecord xcs => box [string "[", - p_list (fn (x, c) => - box [p_con x, - space, - string "=", - space, - p_con c]) xcs, - string "]"] - | CConcat (c1, c2) => parenIf par (box [p_con' true c1, - space, - string "++", - space, - p_con c2]) - -and p_con c = p_con' false c - -fun p_decl ((d, _) : decl) = - case d of - DCon (x, NONE, c) => box [string "con", - space, - string x, - space, - string "=", - space, - p_con c] - | DCon (x, SOME k, c) => box [string "con", - space, - string x, - space, - string "::", - space, - p_kind k, - space, - string "=", - space, - p_con c] - -val p_file = p_list_sep newline p_decl - -end diff --git a/src/lacweb.grm b/src/lacweb.grm index 2f9150fa..a6054494 100644 --- a/src/lacweb.grm +++ b/src/lacweb.grm @@ -27,7 +27,7 @@ (* Grammar for Laconic/Web programs *) -open Laconic +open Source val s = ErrorMsg.spanOf diff --git a/src/source.sml b/src/source.sml new file mode 100644 index 00000000..c42e8bab --- /dev/null +++ b/src/source.sml @@ -0,0 +1,69 @@ +(* Copyright (c) 2008, Adam Chlipala + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - The names of contributors may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *) + +structure Source = struct + +type 'a located = 'a ErrorMsg.located + +datatype kind' = + KType + | KArrow of kind * kind + | KName + | KRecord of kind + +withtype kind = kind' located + +datatype explicitness = + Explicit + | Implicit + +datatype con' = + CAnnot of con * kind + + | TFun of con * con + | TCFun of explicitness * string * kind * con + | TRecord of con + + | CVar of string + | CApp of con * con + | CAbs of explicitness * string * kind * con + + | CName of string + + | CRecord of (con * con) list + | CConcat of con * con + +withtype con = con' located + +datatype decl' = + DCon of string * kind option * con + +withtype decl = decl' located + +type file = decl list + +end diff --git a/src/source_print.sig b/src/source_print.sig new file mode 100644 index 00000000..c21d328a --- /dev/null +++ b/src/source_print.sig @@ -0,0 +1,36 @@ +(* Copyright (c) 2008, Adam Chlipala + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - The names of contributors may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *) + +(* Pretty-printing Laconic/Web *) + +signature SOURCE_PRINT = sig + val p_kind : Source.kind Print.printer + val p_explicitness : Source.explicitness Print.printer + val p_con : Source.con Print.printer + val p_decl : Source.decl Print.printer + val p_file : Source.file Print.printer +end diff --git a/src/source_print.sml b/src/source_print.sml new file mode 100644 index 00000000..704d07ec --- /dev/null +++ b/src/source_print.sml @@ -0,0 +1,147 @@ +(* Copyright (c) 2008, Adam Chlipala + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - The names of contributors may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *) + +(* Pretty-printing Laconic/Web *) + +structure SourcePrint :> SOURCE_PRINT = struct + +open Print.PD +open Print + +open Source + +fun p_kind' par (k, _) = + case k of + KType => string "Type" + | KArrow (k1, k2) => parenIf par (box [p_kind' true k1, + space, + string "->", + space, + p_kind k2]) + | KName => string "Name" + | KRecord k => box [string "{", p_kind k, string "}"] + +and p_kind k = p_kind' false k + +fun p_explicitness e = + case e of + Explicit => string "::" + | Implicit => string ":::" + +fun p_con' par (c, _) = + case c of + CAnnot (c, k) => box [string "(", + p_con c, + space, + string "::", + space, + p_kind k, + string ")"] + + | TFun (t1, t2) => parenIf par (box [p_con' true t1, + space, + string "->", + space, + p_con t2]) + | TCFun (e, x, k, c) => parenIf par (box [string x, + space, + p_explicitness e, + space, + p_kind k, + space, + string "->", + space, + p_con c]) + | TRecord (CRecord xcs, _) => box [string "{", + p_list (fn (x, c) => + box [p_con x, + space, + string ":", + space, + p_con c]) xcs, + string "}"] + | TRecord c => box [string "$", + p_con' true c] + + | CVar s => string s + | CApp (c1, c2) => parenIf par (box [p_con c1, + space, + p_con' true c2]) + | CAbs (e, x, k, c) => parenIf par (box [string "fn", + space, + string x, + space, + p_explicitness e, + space, + p_kind k, + space, + string "=>", + space, + p_con c]) + + | CName s => box [string "#", string s] + + | CRecord xcs => box [string "[", + p_list (fn (x, c) => + box [p_con x, + space, + string "=", + space, + p_con c]) xcs, + string "]"] + | CConcat (c1, c2) => parenIf par (box [p_con' true c1, + space, + string "++", + space, + p_con c2]) + +and p_con c = p_con' false c + +fun p_decl ((d, _) : decl) = + case d of + DCon (x, NONE, c) => box [string "con", + space, + string x, + space, + string "=", + space, + p_con c] + | DCon (x, SOME k, c) => box [string "con", + space, + string x, + space, + string "::", + space, + p_kind k, + space, + string "=", + space, + p_con c] + +val p_file = p_list_sep newline p_decl + +end diff --git a/src/sources b/src/sources index e82c0c7e..9c879139 100644 --- a/src/sources +++ b/src/sources @@ -1,7 +1,7 @@ errormsg.sig errormsg.sml -laconic.sml +source.sml lacweb.grm lacweb.lex @@ -9,8 +9,8 @@ lacweb.lex print.sig print.sml -laconic_print.sig -laconic_print.sml +source_print.sig +source_print.sml elab.sml -- cgit v1.2.3