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

捕获避免和非线性程序转换(包括证明)

Capture-Avoiding and Hygienic Program Transformations (incl. Proofs)

Sebastian Erdweg, Tijs van der Storm, Yi Dai

摘要:

根据抽象语法树的程序转换通过引入变量捕获而损害引用完整性。当在生成的程序中,变量声明意外地隐藏了变量引用的预期目标时,就会发生变量捕获。现有的转换系统要么不能保证避免变量捕获,要么损害转换的实现。我们提出了一个算法,称为名称修复,自动消除变量捕获从生成的程序系统地重命名变量。名称固定由程序的绑定结构的图形表示引导,并且需要用于转换的源语言和目标语言的名称解析算法。name-fix是通用的,适用于任何支持名称起源跟踪的转换系统中的任意转换。我们验证了名称修复的正确性,并确定一个有趣的类的转换名称修复提供卫生。我们证明了名称修复的适用性,实现捕获避免替代,内联,lambda提升,和两个特定领域的语言编译器。

英文摘要:

Program transformations in terms of abstract syntax trees compromise referential integrity by introducing variable capture. Variable capture occurs when in the generated program a variable declaration accidentally shadows the intended target of a variable reference. Existing transformation systems either do not guarantee the avoidance of variable capture or impair the implementation of transformations. We present an algorithm called name-fix that automatically eliminates variable capture from a generated program by systematically renaming variables. name-fix is guided by a graph representation of the binding structure of a program, and requires name-resolution algorithms for the source language and the target language of a transformation. name-fix is generic and works for arbitrary transformations in any transformation system that supports origin tracking for names. We verify the correctness of name-fix and identify an interesting class of transformations for which name-fix provides hygiene. We demonstrate the applicability of name-fix for implementing capture-avoiding substitution, inlining, lambda lifting, and compilers for two domain-specific languages.

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

↑