Intrinsically typed compilation with nameless labels

Author:

Rouvoet Arjen1,Krebbers Robbert2,Visser Eelco1

Affiliation:

1. Delft University of Technology, Netherlands

2. Radboud University Nijmegen, Netherlands / Delft University of Technology, Netherlands

Abstract

To avoid compilation errors it is desirable to verify that a compiler is type correct —i.e., given well-typed source code, it always outputs well-typed target code. This can be done intrinsically by implementing it as a function in a dependently typed programming language, such as Agda. This function manipulates data types of well-typed source and target programs, and is therefore type correct by construction. A key challenge in implementing an intrinsically typed compiler is the representation of labels in bytecode. Because label names are global, bytecode typing appears to be inherently a non-compositional, whole-program property. The individual operations of the compiler do not preserve this property, which requires the programmer to reason about labels, which spoils the compiler definition with proof terms. In this paper, we address this problem using a new nameless and co-contextual representation of typed global label binding, which is compositional. Our key idea is to use linearity to ensure that all labels are defined exactly once. To write concise compilers that manipulate programs in our representation, we develop a linear, dependently typed, shallowly embedded language in Agda, based on separation logic. We show that this language enables the concise specification and implementation of intrinsically typed operations on bytecode, culminating in an intrinsically typed compiler for a language with structured control-flow.

Publisher

Association for Computing Machinery (ACM)

Subject

Safety, Risk, Reliability and Quality,Software

Reference48 articles.

1. Andreas Abel. 2020. Type-preserving compilation via dependently typed syntax in Agda. Abstract of a talk at TYPES available online at http://www.cse.chalmers.se/~abela/types20.pdf slides available online at http://www.cse.chalmers.se/ ~abela/talkTYPES2020.pdf. Andreas Abel. 2020. Type-preserving compilation via dependently typed syntax in Agda. Abstract of a talk at TYPES available online at http://www.cse.chalmers.se/~abela/types20.pdf slides available online at http://www.cse.chalmers.se/ ~abela/talkTYPES2020.pdf.

2. Thorsten Altenkirch James Chapman and Tarmo Uustalu. 2015. Monads need not be endofunctors. Logical Methods in Computer Science (LMCS) 11 1 ( 2015 ). https://doi.org/10.2168/LMCS-11 ( 1 :3) 2015 10.2168/LMCS-11(1:3)2015 Thorsten Altenkirch James Chapman and Tarmo Uustalu. 2015. Monads need not be endofunctors. Logical Methods in Computer Science (LMCS) 11 1 ( 2015 ). https://doi.org/10.2168/LMCS-11 ( 1 :3) 2015 10.2168/LMCS-11(1:3)2015

3. Foundational proof-carrying code

4. Compiling with Continuations

Cited by 4 articles. 订阅此论文施引文献 订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献

1. An Intrinsically Typed Compiler for Algebraic Effect Handlers;Proceedings of the 2024 ACM SIGPLAN International Workshop on Partial Evaluation and Program Manipulation;2024-01-11

2. Special Delivery: Programming with Mailbox Types;Proceedings of the ACM on Programming Languages;2023-08-30

3. Connectivity graphs: a method for proving deadlock freedom based on separation logic;Proceedings of the ACM on Programming Languages;2022-01-12

4. Calculating dependently-typed compilers (functional pearl);Proceedings of the ACM on Programming Languages;2021-08-22

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3