Rust Distilled:一座语言表达之塔
Rust Distilled: An Expressive Tower of Languages
摘要:
Rust代表了生产程序设计语言的一个重大进步,因为它成功地弥合了高级应用程序编程和低级系统编程之间的差距。其设计的核心在于一种新颖的所有权方法,这种方法仍然是高度可编程的。在这个演讲中,我们将描述我们正在进行的工作,为Rust设计一个正式的语义,在没有生命周期分析的情况下捕获所有权和借用。这种语义对所有权的高级理解进行建模,因此接近源代码级别的Rust(但具有完整的类型注释),这与最近的RustBelt工作不同,RustBelt工作本质上是对MIR进行建模,MIR是Rust编译器中使用的CPS风格的IR。此外,虽然RustBelt旨在验证Rust标准库中不安全代码的安全性,但我们将标准库API建模为原语,这足以解释它们的行为。这产生了一个更简单的Rust模型及其类型系统,我们认为研究人员会发现它更容易作为研究Rust扩展的起点。与RustBelt不同,我们的目标是使用进步和保护来证明类型的可靠性,而不是Kripke逻辑关系。最后,我们的语义是一个不断增加的表达能力的语言家族,其中后续级别具有在先前级别中无法定义的功能。根据Felleisen,表达力是根据观察等效来定义的。将语言分为不同的表达能力级别应该为Rust验证和编译器优化的未来工作提供框架。
英文摘要:
Rust represents a major advancement in production programming languages because of its success in bridging the gap between high-level application programming and low-level systems programming. At the heart of its design lies a novel approach to ownership that remains highly programmable. In this talk, we will describe our ongoing work on designing a formal semantics for Rust that captures ownership and borrowing without the details of lifetime analysis. This semantics models a high-level understanding of ownership and as a result is close to source-level Rust (but with full type annotations) which differs from the recent RustBelt effort that essentially models MIR, a CPS-style IR used in the Rust compiler. Further, while RustBelt aims to verify the safety of unsafe code in Rust's standard library, we model standard library APIs as primitives, which is sufficient to reason about their behavior. This yields a simpler model of Rust and its type system that we think researchers will find easier to use as a starting point for investigating Rust extensions. Unlike RustBelt, we aim to prove type soundness using progress and preservation instead of a Kripke logical relation. Finally, our semantics is a family of languages of increasing expressive power, where subsequent levels have features that are impossible to define in previous levels. Following Felleisen, expressive power is defined in terms of observational equivalence. Separating the language into different levels of expressive power should provide a framework for future work on Rust verification and compiler optimization.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。