Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/3236950.3236965acmotherconferencesArticle/Chapter ViewAbstractPublication PagesppdpConference Proceedingsconference-collections
research-article

An Internalist Approach to Correct-by-Construction Compilers

Published: 03 September 2018 Publication History

Abstract

In this paper we present a methodology to organize the construction of a correct compiler, taking advantage of the power of full dependently type systems. The basic idea consists in decorating the abstract syntax of languages with their semantics, allowing to express the correctness of the compiler at type level. We show our methodology in a first small example and then explore how it can be promoted to more realistic languages, realizing that our internalistic approach is feasible for defining a correct-by-construction compiler from an imperative language with conditional iteration to a stack based intermediate language. We also show how this methodology can be combined with the externalist approach, compiling from the intermediate language to an assembly-like low level code and separately proving its correctness.

References

[1]
Andreas Abel and James Chapman. 2014. Normalization by Evaluation in the Delay Monad: A Case Study for Coinduction via Copatterns and Sized Types. In Proceedings 5th Workshop on Mathematically Structured Functional Programming, MSFP@ETAPS 2014, Grenoble, France, 12 April 2014. (EPTCS), Paul Levy and Neel Krishnaswami (Eds.), Vol. 153. 51--67.
[2]
Robert Atkey, Patricia Johann, and Neil Ghani. 2011. When Is a Type Refinement an Inductive Type?. In Foundations of Software Science and Computational Structures - 14th International Conference, FOSSACS 2011, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2011, Saarbrücken, Germany, March 26-April 3, 2011. Proceedings (Lecture Notes in Computer Science), Martin Hofmann (Ed.), Vol. 6604. Springer, 72--87.
[3]
Robert Atkey, Patricia Johann, and Neil Ghani. 2012. Refining Inductive Types. Logical Methods in Computer Science 8, 2 (2012).
[4]
Nick Benton, Andrew Kennedy, and Carsten Varming. 2009. Some Domain Theory and Denotational Semantics in Coq. In Theorem Proving in Higher Order Logics, Stefan Berghofer, Tobias Nipkow, Christian Urban, and Makarius Wenzel (Eds.). Lecture Notes in Computer Science, Vol. 5674. Springer Berlin Heidelberg, 115--130.
[5]
Pierre-Évariste Dagand and Conor McBride. 2014. Transporting functions across ornaments. J. Funct. Program. 24, 2-3 (2014), 316--383.
[6]
Hsiang-Shang Ko and Jeremy Gibbons. 2011. Modularising Inductive Families. In Proceedings of the Seventh ACM SIGPLAN Workshop on Generic Programming (WGP '11). ACM, New York, NY, USA, 13--24.
[7]
Xavier Leroy. 2006. Formal Certification of a Compiler Back-end or: Programming a Compiler with a Proof Assistant. SIGPLAN Not. 41, 1 (Jan. 2006), 42--54.
[8]
Cecilia Manzino. 2018. Security preserving program translations. Master's thesis. PEDECIBA Informática, Universidad de la República, Uruguay.
[9]
Cecilia Manzino and Alberto Pardo. 2014. A Security Types Preserving Compiler in Haskell. In Programming Languages - 18th Brazilian Symposium, SBLP 2014, Maceio, Brazil, October 2-3, 2014. Proceedings (Lecture Notes in Computer Science), Fernando Magno Quintão Pereira (Ed.), Vol. 8771. Springer, 16--30.
[10]
Per Martin-Löf. 1984. Intuitionistic Type Theory. Bibliopolis.
[11]
Conor McBride. 2011. Ornamental algebras, algebraic ornaments. unpublished (2011).
[12]
Conor Thomas McBride. 2012. Agda-curious?: An Exploration of Programming with Dependent Types. In Proceedings of the 17th ACM SIGPLAN International Conference on Functional Programming (ICFP '12). ACM, New York, NY, USA, 1--2.
[13]
John McCarthy and James Painter. 1967. Correctness of a compiler for arithmetic expressions. American Mathematical Society, 33--41.
[14]
James McKinna and Joel Wright. 2006. A type-correct, stack-safe, provably correct, expression compiler. Submitted to the Journal of Functional Programming (2006).
[15]
F Lockwood Morris. 1973. Advice on structuring compilers and proving them correct. In Proceedings of the 1st annual ACM SIGACT-SIGPLAN symposium on Principles of programming languages. ACM, 144--152.
[16]
Scott Owens, Magnus O. Myreen, Ramana Kumar, and Yong Kiam Tan. 2016. Functional Big-Step Semantics. In Programming Languages and Systems - 25th European Symposium on Programming, ESOP 2016, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2016, Eindhoven, The Netherlands, April 2-8, 2016, Proceedings (Lecture Notes in Computer Science), Peter Thiemann (Ed.), Vol. 9632. Springer, 589--615.
[17]
James W Thatcher, Eric G Wagner, and Jesse B Wright. 1980. More on advice on structuring compilers and proving them correct. In International Workshop on Semantics-Directed Compiler Generation. Springer, 165--188.
[18]
Thomas Williams, Pierre-Évariste Dagand, and Didier Rémy. 2014. Ornaments in practice. In Proceedings of the 10th ACM SIGPLAN workshop on Generic programming, WGP 2014, Gothenburg, Sweden, August 31, 2014, José Pedro Magalhães and Tiark Rompf (Eds.). ACM, 15--24.
[19]
Thomas Williams and Didier Rémy.2018. A principled approach to ornamentation in ML. PACMPL 2, POPL (2018), 21:1-21:30.

Cited By

View all
  • (2021)Calculating dependently-typed compilers (functional pearl)Proceedings of the ACM on Programming Languages10.1145/34735875:ICFP(1-27)Online publication date: 19-Aug-2021
  • (2021)Intrinsically typed compilation with nameless labelsProceedings of the ACM on Programming Languages10.1145/34343035:POPL(1-28)Online publication date: 4-Jan-2021
  • (2020)A formalisation of LEGv8 in AgdaProceedings of the 24th Brazilian Symposium on Context-Oriented Programming and Advanced Modularity10.1145/3427081.3427086(33-39)Online publication date: 19-Oct-2020

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Other conferences
PPDP '18: Proceedings of the 20th International Symposium on Principles and Practice of Declarative Programming
September 2018
306 pages
ISBN:9781450364416
DOI:10.1145/3236950
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 03 September 2018

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. compiler design
  2. correct-by-construction
  3. dependent types
  4. dependently-typed programming indexed families
  5. ornaments

Qualifiers

  • Research-article
  • Research
  • Refereed limited

Conference

PPDP '18

Acceptance Rates

PPDP '18 Paper Acceptance Rate 22 of 39 submissions, 56%;
Overall Acceptance Rate 230 of 486 submissions, 47%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)12
  • Downloads (Last 6 weeks)2
Reflects downloads up to 21 Sep 2024

Other Metrics

Citations

Cited By

View all
  • (2021)Calculating dependently-typed compilers (functional pearl)Proceedings of the ACM on Programming Languages10.1145/34735875:ICFP(1-27)Online publication date: 19-Aug-2021
  • (2021)Intrinsically typed compilation with nameless labelsProceedings of the ACM on Programming Languages10.1145/34343035:POPL(1-28)Online publication date: 4-Jan-2021
  • (2020)A formalisation of LEGv8 in AgdaProceedings of the 24th Brazilian Symposium on Context-Oriented Programming and Advanced Modularity10.1145/3427081.3427086(33-39)Online publication date: 19-Oct-2020

View Options

Get Access

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media