adam@1989: (* Copyright (c) 2014, Adam Chlipala adam@1989: * All rights reserved. adam@1989: * adam@1989: * Redistribution and use in source and binary forms, with or without adam@1989: * modification, are permitted provided that the following conditions are met: adam@1989: * adam@1989: * - Redistributions of source code must retain the above copyright notice, adam@1989: * this list of conditions and the following disclaimer. adam@1989: * - Redistributions in binary form must reproduce the above copyright notice, adam@1989: * this list of conditions and the following disclaimer in the documentation adam@1989: * and/or other materials provided with the distribution. adam@1989: * - The names of contributors may not be used to endorse or promote products adam@1989: * derived from this software without specific prior written permission. adam@1989: * adam@1989: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" adam@1989: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE adam@1989: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE adam@1989: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE adam@1989: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR adam@1989: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF adam@1989: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS adam@1989: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN adam@1989: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) adam@1989: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE adam@1989: * POSSIBILITY OF SUCH DAMAGE. adam@1989: *) adam@1989: adam@1989: (* To simplify Corify, it helps to apply a particular kind of renaming to functor adam@1989: * bodies, so that nested functors refer only to fresh names. The payoff is that adam@1989: * we can then implement applications of those nested functors by evaluating their adam@1989: * bodies in arbitrary later contexts, even where identifiers defined in the adam@1989: * outer functor body may have been shadowed. *) adam@1989: adam@1989: signature EXPL_RENAME = sig adam@1989: adam@1989: val rename : {NextId : int, adam@1989: FormalName : string, adam@1989: FormalId : int, adam@1989: Body : Expl.str} -> int * Expl.str adam@1989: adam@1989: end