Implementing a Notion of Modules in the Logic Programming Language Lambda-Prolog

Implementing a Notion of Modules in the Logic Programming Language Lambda-Prolog
复制标题

在逻辑编程语言 Lambda-Prolog 中实现模块的概念

DOI:
10.1007/3-540-56454-3_18
复制
发表时间:
1992
期刊:
--
影响因子:
--
通讯作者:
D. S. Wilson
D. S. Wilson
中科院分区:
--
文献类型:
--
作者:
Keehang Kwon;G. Nadathur;D. S. Wilson

文献摘要

被引文献

相似文献

研究了高阶逻辑程序设计语言λProlog中模块概念的实现问题。这种语言中的程序是类型声明和过程定义的组合。所考虑的模块构造允许将这些声明和定义的大集合分解成更小的单元。提供了控制这些单位之间的互动和限制任何单位内使用的名称的可见性的机制。模块之间的典型交互具有静态和动态两种性质。模块中表达式的解析可能需要与之交互的模块中的声明,并且此信息必须在编译期间可用。一个模块中的过程定义可能会利用其他模块中提供的过程,并且必须提供支持,以便在执行期间进行适当的调用。我们在这里主要关注模块交互的动态方面。我们描述了一种将每个模块编译成独立代码片段的方法。静态交互防止交互模块的编译完全解耦。然而,使用这里提出的接口定义的思想,即使在这个级别上也可以实现相当程度的独立性。模块构造的动态语义涉及用特定模块中定义的过程来增强现有的程序上下文。提出了一种通过应用于为每个模块生成的编译代码的链接过程来实现这种效果的方法。动态语义的直接实现导致搜索中的相当大的冗余。我们提出了一种方法,这种冗余可以控制,证明我们的方法的正确性,并描述了运行时结构,将这个想法纳入整体实现。
Issues concerning the implementation of a notion of modules in the higher-order logic programming language λProlog are examined. A program in this language is a composite of type declarations and procedure definitions. The module construct that is considered permits large collections of such declarations and definitions to be decomposed into smaller units. Mechanisms are provided for controlling the interaction of these units and for restricting the visibility of names used within any unit. The typical interaction between modules has both a static and a dynamic nature. The parsing of expressions in a module might require declarations in a module that it interacts with, and this information must be available during compilation. Procedure definitions within a module might utilize procedures presented in other modules and support must be provided for making the appropriate invocation during execution. Our concern here is largely with the dynamic aspects of module interaction. We describe a method for compiling each module into an independent fragment of code. Static interactions prevent the compilation of interacting modules from being completely decoupled. However, using the idea of an interface definition presented here, a fair degree of independence can be achieved even at this level. The dynamic semantics of the module construct involve enhancing existing program contexts with the procedures defined in particular modules. A method is presented for achieving this effect through a linking process applied to the compiled code generated for each module. A direct implementation of the dynamic semantics leads to considerable redundancy in search. We present a way in which this redundancy can be controlled, prove the correctness of our approach and describe run-time structures for incorporating this idea into the overall implementation.