Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article

Typed self-interpretation by pattern matching

Published: 19 September 2011 Publication History

Abstract

Self-interpreters can be roughly divided into two sorts: self-recognisers that recover the input program from a canonical representation, and self-enactors that execute the input program. Major progress for statically-typed languages was achieved in 2009 by Rendel, Ostermann, and Hofer who presented the first typed self-recogniser that allows representations of different terms to have different types. A key feature of their type system is a type:type rule that renders the kind system of their language inconsistent.
In this paper we present the first statically-typed language that not only allows representations of different terms to have different types, and supports a self-recogniser, but also supports a self-enactor. Our language is a factorisation calculus in the style of Jay and Given-Wilson, a combinatory calculus with a factorisation operator that is powerful enough to support the pattern-matching functions necessary for a self-interpreter. This allows us to avoid a type:type rule. Indeed, the types of System F are sufficient. We have implemented our approach and our experiments support the theory.

Supplementary Material

MP4 File (_talk10.mp4)

References

[1]
Harold Abelson, Gerald Jay Sussman, and Julie Sussman. Structure and Interpretation of Computer Programs. MIT Press, 1985.
[2]
Henk Barendregt. Self-interpretations in lambda calculus. J. Funct. Program, 1(2):229--233, 1991.
[3]
HP Barendregt. Handbook of Logic in Computer Science (vol. 2): Background: Computational Structures: Abramski,S (ed), chapter Lambda Calculi with Types. Oxford University Press, Inc., New York, NY, 1993.
[4]
Michel Bel. A recursion theoretic self interpreter for the lambda-calculus. http://www.belxs.com/michel/#selfint.
[5]
Alessandro Berarducci and Corrado Böhm. A self-interpreter of lambda calculus having a normal form. In CSL, pages 85--99, 1992.
[6]
Mathieu Boespflug. From self-interpreters to normalization by evaluation. In Olivier Danvy, editor, Proceedings of Workshop on Normalization by Evaluation, 2009.
[7]
bondi programming language. www-staff.it.uts.edu.au/~cbj/bondi.
[8]
Reg Braithwaite. The significance of the meta-circular interpreter. http://weblog.raganwald.com/2006/11/significance-of-meta-circular_22.html, November 2006.
[9]
Jacques Carette, Oleg Kiselyov, and Chung chieh Shan. Finally tagless, partially evaluated: Tagless staged interpreters for simpler typed languages. Journal of Functional Programming, 19(5):509--543, 2009.
[10]
Olivier Danvy and Pablo E. Martínez López. Tagging, encoding, and Jones optimality. In Proceedings of ESOP'03, European Symposium on Programming, pages 335--347. Springer-Verlag (LNCS), 2003.
[11]
Sir Arthur Conan Doyle. The Sign of the Four. Lippincott's Monthly Magazine, February 1890.
[12]
Brendan Eich. Narcissus. http://mxr.mozilla.org/mozilla/source/js/narcissus/jsexec.js, 2010.
[13]
J-Y. Girard, Y. Lafont, and P. Taylor. Proofs and Types. Tracts in Theoretical Computer Science. Cambridge University Press, 1989.
[14]
Masami Hagiya. Meta-circular interpreter for a strongly typed language. Journal of Symbolic Computation, 8(6):651--680, 1989.
[15]
R. Hindley and J. P. Seldin. Introduction to Combinators and Lambda-calculus. Cambridge University Press, 1986.
[16]
Barry Jay. Pattern Calculus: Computing with Functions and Structures. Springer, 2009.
[17]
Barry Jay and Thomas Given-Wilson. A combinatory account of internal structure. Journal of Symbolic Logic, 2011. To appear. http://www-staff.it.uts.edu.au/~cbj/Publications/factorisation.pdf.
[18]
Barry Jay and Delia Kesner. First-class patterns. Journal of Functional Programming, 19(2):191--225, 2009.
[19]
C. B. Jay. The pattern calculus. ACM Transactions on Programming Languages and Systems (TOPLAS), 26(6):911--937, November 2004.
[20]
S.C. Kleene. Introduction to Methamathematics. van Nostrand, 1952.
[21]
Stephen C. Kleene. λ-definability and recursiveness. Duke Math. J., pages 340--353, 1936.
[22]
Konstantin Läufer and Martin Odersky. Self-interpretation and reflection in a statically typed language. In Proceedings of OOPSLA Workshop on Reflection and Metalevel Architectures. ACM, October 1993.
[23]
Oleg Mazonka and Daniel B. Cristofani. A very short self-interpreter. http://arxiv.org/html/cs/0311032v1, November 2003.
[24]
J. C. Mitchell. Polymorphic type inference and containment. Information and Computation, 1985.
[25]
Torben Æ. Mogensen. Efficient self-interpretations in lambda calculus. Journal of Functional Programming, 2(3):345--363, 1992. See also DIKU Report D-128, Sep 2, 1994.
[26]
Torben Æ. Mogensen. Linear-time self-interpretation of the pure lambda calculus. Higher-Order and Symbolic Computation, 13(3):217--237, 2000.
[27]
Greg Morrisett, David Walker, Karl Crary, and Neal Glew. From System F to typed assembly language. In Proceedings of POPL'98, 25th Annual SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 85--97, 1998.
[28]
Matthew Naylor. Evaluating Haskell in Haskell. The Monad.Reader, 10:25--33, 2008.
[29]
Frank Pfenning and Peter Lee. Metacircularity in the polymorphic λ-calculus. Theoretical Computer Science, 89(1):137--159, 1991.
[30]
Didier Rémy. Simple, partial type-inference for System F based on type-containment. In Proceedings of the tenth ACM SIGPLAN international conference on Functional programming, ICFP '05, pages 130--143, New York, NY, USA, 2005. ACM.
[31]
Tillmann Rendel, Klaus Ostermann, and Christian Hofer. Typed self-representation. In Proceedings of PLDI'09, ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 293--303, June 2009.
[32]
John C. Reynolds. Definitional interpreters for higher-order programming languages. In Proceedings of 25th ACM National Conference, pages 717--740. ACM Press, 1972. The paper later appeared in Higher-Order and Symbolic Computation, 11, 363--397 (1998).
[33]
Armin Rigo and Samuele Pedroni. Pypy's approach to virtual machine construction. In OOPSLA Companion, pages 044--953, 2006.
[34]
Andreas Rossberg. HaMLet. http://www.mpi-sws.org/rossberg/hamlet, 2010.
[35]
Fangmin Song, Yongsen Xu, and Yuechen Qian. The self-reduction in lambda calculus. Theoretical Computer Science, 235(1):171--181, March 2000.
[36]
Walid Taha, Henning Makholm, and John Hughes. Tag elimination and Jones-optimality. In Proceedings of PADO'01, Programs as Data Objects, Second Symposium, pages 257--275, 2001.
[37]
Terese. Term Rewriting Systems, volume 53 of Tracts in Theoretical Computer Science. Cambridge University Press, 2003.
[38]
John Tromp. Binary lambda calculus and combinatory logic. In Kolmogorov Complexity and Applications, 2006. A Revised Version is available at http://homepages.cwi.nl/tromp/cl/LC.pdf.
[39]
J. B. Wells. Typability and type checking in the second-order λ-calculus are equivalent and undecidable. In Proceedings of LICS'94, Ninth Annual IEEE Symposium on Logic in Computer Science, 1994.
[40]
Wikipedia. Pypy. http://en.wikipedia.org/wiki/PyPy, 2010.
[41]
Wikipedia. Rubinius. http://en.wikipedia.org/wiki/Rubinius, 2010.
[42]
Tetsuo Yokoyama and Robert Glück. A reversible programming language and its invertible self-interpreter. In Proceedings of PEPM'07, ACM Symposium on Partial Evaluation and Semantics-Based Program Manipulation, 2007.

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM SIGPLAN Notices
ACM SIGPLAN Notices  Volume 46, Issue 9
ICFP '11
September 2011
456 pages
ISSN:0362-1340
EISSN:1558-1160
DOI:10.1145/2034574
Issue’s Table of Contents
  • cover image ACM Conferences
    ICFP '11: Proceedings of the 16th ACM SIGPLAN international conference on Functional programming
    September 2011
    470 pages
    ISBN:9781450308656
    DOI:10.1145/2034773
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]

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 19 September 2011
Published in SIGPLAN Volume 46, Issue 9

Check for updates

Author Tags

  1. pattern matching
  2. self-interpretation

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)5
  • Downloads (Last 6 weeks)0
Reflects downloads up to 27 Jan 2025

Other Metrics

Citations

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media