论文标题

语言互操作性的语义健全性

Semantic Soundness for Language Interoperability

论文作者

Patterson, Daniel, Mushtak, Noble, Wagner, Andrew, Ahmed, Amal

论文摘要

程序很少以单一语言实现,因此,类型的声音问题不仅应解决单一语言的语义,还应解决其与他人互动的方式。即使在类型安全的语言之间,不同的特征会挫败互操作性,因为一种语言的不变性很容易在另一种语言中违反。 Matthews和Findler在其2007年的开创性论文中提出了一种多语言结构,该构造通过一对边界增强了互操作语言,允许一种语言中的代码嵌入另一种语言。尽管该技术已被广泛应用,但它们的句法源级互操作性并不能反映实际的实现,在汇编与共同目标之后定义了相互作用的行为,并且必须通过目标不变性或插入目标级别级别的“胶水代码”来确保任何安全性。 在本文中,我们提出了一个框架,以设计和验证声音语言互操作性之后,该框架遵循互动策略。语言设计师指定可以通过关系$τ_A\simτ_b$在语言类型之间转换哪些数据,并指定目标粘合代码实现转换。然后,通过将源类型的语义模型作为目标项集,我们可以确定转换的健全性:每当$τ_a\ simτ_b$时,相应的转换对对的对目标术语将$τ_A$转换为$τ_A$,以$τ_a$为目标项,而行为$τ_b$,以及VISSA。然后,我们可以证明整个系统的语义类型。我们通过一系列案例研究来说明我们的框架,这些案例研究表明我们的语义互编兼容方法如何使我们既可以考虑语言语义上的复杂差异,又可以根据编译器或目标的特殊性进行效率折衷。

Programs are rarely implemented in a single language, and thus questions of type soundness should address not only the semantics of a single language, but how it interacts with others. Even between type-safe languages, disparate features frustrate interoperability, as invariants from one language can easily be violated in the other. In their seminal 2007 paper, Matthews and Findler proposed a multi-language construction that augments the interoperating languages with a pair of boundaries that allow code from one language to be embedded in the other. While the technique has been widely applied, their syntactic source-level interoperability doesn't reflect practical implementations, where behavior of interaction is defined after compilation to a common target, and any safety must be ensured by target invariants or inserted target-level "glue code." In this paper, we present a framework for the design and verification of sound language interoperability that follows an interoperation-after-compilation strategy. Language designers specify what data can be converted between types of the languages via a relation $τ_A \sim τ_B$ and specify target glue code implementing conversions. Then, by giving a semantic model of source types as sets of target terms, we can establish soundness of conversions: i.e., whenever $τ_A \sim τ_B$, the corresponding pair of conversions convert target terms that behave as $τ_A$ to target terms that behave as $τ_B$, and vice versa. We can then prove semantic type soundness for the entire system. We illustrate our framework via a series of case studies that demonstrate how our semantic interoperation-after-compilation approach allows us both to account for complex differences in language semantics and make efficiency trade-offs based on particularities of compilers or targets.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源