On declarative rewriting for sound and complete union, intersection and negation types

被引:2
|
作者
Pearce, David J. [1 ]
机构
[1] Victoria Univ Wellington, Sch Engn & Comp Sci, Wellington, New Zealand
关键词
Rewrite systems; Type systems; Type theory; !text type='JAVA']JAVA[!/text] BYTECODE VERIFICATION; LANGUAGE; SPECIFICATION; TOOL;
D O I
10.1016/j.jvlc.2018.10.004
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Implementing the type system of a programming language is a critical task that is often done in an ad-hoc fashion. Whilst this makes it hard to ensure the system is sound, it also makes it difficult to extend as the language evolves. We are interested in describing type systems using rewrite rules from which an implementation can be automatically generated. Whilst not all type systems are easily expressed in this manner, those involving unions, intersections and negations are well-suited for this. For example, subtyping in such systems is naturally expressed as a maximal reduction over the intersection of types involved. In this paper, we consider a relatively complex type system involving unions, intersections and negations developed previously in the context of type checking. This system was not developed with rewriting in mind, though clear parallels are immediately apparent from the original presentation. For example, the system presented required types be first converted into a variation on Disjunctive Normal Form. However, some aspects of the original system are more challenging to express with rewrite rules. We identify that the original system can, for the most part, be reworked to enable a natural expression using rewrite rules. We present an implementation of our rewrite rules in the Whiley Rewrite Language (WyRL), and report performance results compared with a hand-coded solution. We also present an implementation of our system in the Rascal rewriting system, and find different trade offs.
引用
收藏
页码:84 / 101
页数:18
相关论文
共 44 条
  • [1] Rewriting for Sound and Complete Union, Intersection and Negation Types
    Pearce, David J.
    [J]. PROCEEDINGS OF THE 16TH ACM SIGPLAN INTERNATIONAL CONFERENCE ON GENERATIVE PROGRAMMING: CONCEPTS AND EXPERIENCES (GPCE'17), 2017, : 117 - 130
  • [2] Rewriting for Sound and Complete Union, Intersection and Negation Types
    Pearce, David J.
    [J]. ACM SIGPLAN NOTICES, 2017, 52 (12) : 117 - 130
  • [3] Semantic subtyping: dealing set-theoretically with function, union, intersection, and negation types
    Frisch, Alain
    Castagna, Giuseppe
    Benzaken, Veronique
    [J]. JOURNAL OF THE ACM, 2008, 55 (04)
  • [4] INTERSECTION AND UNION TYPES
    BARBANERA, F
    DEZANICIANCAGLINI, M
    [J]. LECTURE NOTES IN COMPUTER SCIENCE, 1991, 526 : 651 - 674
  • [5] Elaborating Intersection and Union Types
    Dunfield, Joshua
    [J]. ACM SIGPLAN NOTICES, 2012, 47 (09) : 17 - 28
  • [6] Elaborating intersection and union types
    Dunfield, Joshua
    [J]. JOURNAL OF FUNCTIONAL PROGRAMMING, 2014, 24 (2-3) : 133 - 165
  • [7] Intersection and Union Types for chi
    van Bakel, Steffen
    [J]. ELECTRONIC NOTES IN THEORETICAL COMPUTER SCIENCE, 2005, 136 : 203 - 227
  • [8] Isomorphism of intersection and union types
    Coppo, Mario
    Dezani-Ciancaglini, Mariangiola
    Margaria, Ines
    Zacchi, Maddalena
    [J]. MATHEMATICAL STRUCTURES IN COMPUTER SCIENCE, 2017, 27 (05) : 603 - 625
  • [9] A SOUND AND COMPLETE SEMANTICS FOR A VERSION OF NEGATION AS FAILURE
    SHEPHERDSON, JC
    [J]. THEORETICAL COMPUTER SCIENCE, 1989, 65 (03) : 343 - 371
  • [10] A Realizability Interpretation for Intersection and Union Types
    Dougherty, Daniel J.
    de'Liguoro, Ugo
    Liquori, Luigi
    Stolze, Claude
    [J]. PROGRAMMING LANGUAGES AND SYSTEMS, APLAS 2016, 2016, 10017 : 187 - 205