arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2303.10453cs.PL
收藏

逻辑程序设计中的模块化与分离编译

Modularity and Separate Compilation in Logic Programming

Steven Holte, Gopalan Nadathur

摘要:

以模块化方式编写代码的能力对于构建大型程序很重要。在逻辑编程环境中,希望通过基于逻辑的设备实现此类功能。我们在这里描述了一种实现此目的的方法。在我们的方案中,一个模块对应于一个代码块,其外部视图是由签名介导的。因此,签名强加了一种形式的隐藏,通过谓词,函数和常量名称的存在量化在逻辑上解释。模块通过累积机制进行交互,累积机制转化为连接其中的子句,同时尊重签名引入的存在量词的范围。我们表明,这种简单的静态结构化命名空间的设备足以实现与代码范围相关的功能,谓词定义的动态控制早先被认为是必要的。我们提出的模块功能以前已经通过累积模块的编译时内联实现。此方法不支持单独编译。我们纠正这种情况下,每个不同的模块可以单独编译和内联可以实现一个后来的,互补的,同样有效的链接阶段。

英文摘要:

The ability to compose code in a modular fashion is important to the construction of large programs. In the logic programming setting, it is desirable that such capabilities be realized through logic-based devices. We describe an approach for doing this here. In our scheme a module corresponds to a block of code whose external view is mediated by a signature. Thus, signatures impose a form of hiding that is explained logically via existential quantifications over predicate, function and constant names. Modules interact through the mechanism of accumulation that translates into conjoining the clauses in them while respecting the scopes of existential quantifiers introduced by signatures. We show that this simple device for statically structuring name spaces suffices for realizing features related to code scoping for which the dynamic control of predicate definitions was earlier considered necessary. The module capabilities we present have previously been implemented via the compile-time inlining of accumulated modules. This approach does not support separate compilation. We redress this situation by showing how each distinct module can be compiled separately and inlining can be realized by a later, complementary and equally efficient linking phase.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑