Semantic Soundness for Language Interoperability

02/26/2022
by   Daniel Patterson, et al.
0

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 ∼τ_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 ∼τ_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.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
09/18/2019

A Three-Valued Semantics for Typed Logic Programming

Types in logic programming have focused on conservative approximations o...
research
10/05/2020

Wasm/k: Delimited Continuations for WebAssembly

WebAssembly is designed to be an alternative to JavaScript that is a saf...
research
11/27/2012

On the Use of Underspecified Data-Type Semantics for Type Safety in Low-Level Code

In recent projects on operating-system verification, C and C++ data type...
research
10/12/2018

Semantic subtyping for non-strict languages

Semantic subtyping is an approach to define subtyping relations for type...
research
07/20/2022

Auto-active Verification of Graph Algorithms, Written in OCaml

Functional programming offers the perfect ground for building correct-by...
research
07/08/2018

Graduality from Embedding-projection Pairs (Extended Version)

Gradually typed languages allow statically typed and dynamically typed c...
research
05/18/2020

Sham: A DSL for Fast DSLs

Domain-specific languages (DSLs) are touted as both easy to embed in pro...

Please sign up or login with your details

Forgot password? Click here to reset