论文标题
大型语义定义样式的比较
A Comparison of Big-step Semantics Definition Styles
论文作者
论文摘要
正式的语义提供了对编程语言的严格,数学精确的定义,我们可以通过正式手段来争论程序行为和程序等价。特别是,我们可以通过证明助手来描述和验证我们的论点。在不同的抽象级别和应用不同的数学机械上,为编程语言提供正式语义的方法有多种方法:使用语义的原因确定选择哪种方法。 在本文中,我们研究了一些与传统的关系大型语义分享其根源的方法,例如(a)功能性的大步骤语义(或等效地,定义性解释器),(b)漂亮基准步骤语义和(c)传统的自然语义。我们将这些方法相对于以下标准进行了比较:语义定义的可执行性,典型属性的证明复杂性(例如确定论)以及该方法中表达等价证明的简洁性。我们还简要讨论了这些定义的复杂性和共同感应的大步语义,从而使有关差异的推理。 为了启用实践中的比较,我们提出了一种示例语言,用于比较语义:核心erlang的顺序子集,一种功能编程语言,该语言用于ERLANG/OTP编译器的中间步骤中。我们已经为该语言定义了一种关系大型语义,其中包括对例外和副作用的处理。这项当前工作的目的是将我们对该语言的最大定义与不同样式的其他等效语义从测试和验证代码重构的角度进行比较。
Formal semantics provides rigorous, mathematically precise definitions of programming languages, with which we can argue about program behaviour and program equivalence by formal means; in particular, we can describe and verify our arguments with a proof assistant. There are various approaches to giving formal semantics to programming languages, at different abstraction levels and applying different mathematical machinery: the reason for using the semantics determines which approach to choose. In this paper we investigate some of the approaches that share their roots with traditional relational big-step semantics, such as (a) functional big-step semantics (or, equivalently, a definitional interpreter), (b) pretty-big-step semantics and (c) traditional natural semantics. We compare these approaches with respect to the following criteria: executability of the semantics definition, proof complexity for typical properties (e.g. determinism) and the conciseness of expression equivalence proofs in that approach. We also briefly discuss the complexity of these definitions and the coinductive big-step semantics, which enables reasoning about divergence. To enable the comparison in practice, we present an example language for comparing the semantics: a sequential subset of Core Erlang, a functional programming language, which is used in the intermediate steps of the Erlang/OTP compiler. We have already defined a relational big-step semantics for this language that includes treatment of exceptions and side effects. The aim of this current work is to compare our big-step definition for this language with a variety of other equivalent semantics in different styles from the point of view of testing and verifying code refactorings.