skip to main content
article
Public Access

Sequent calculus as a compiler intermediate language

Published:04 September 2016Publication History
Skip Abstract Section

Abstract

The λ-calculus is popular as an intermediate language for practical compilers. But in the world of logic it has a lesser-known twin, born at the same time, called the sequent calculus. Perhaps that would make for a good intermediate language, too? To explore this question we designed Sequent Core, a practically-oriented core calculus based on the sequent calculus, and used it to re-implement a substantial chunk of the Glasgow Haskell Compiler.

References

  1. A. W. Appel. Compiling with Continuations. Cambridge University Press, New York, NY, USA, 1992. ISBN 0-521-41695-7. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Z. M. Ariola and H. Herbelin. Control reduction theories: The benefit of structural substitution. Journal of Functional Programming, 18(3):373– 419, May 2008. ISSN 0956-7968. doi: 10.1017/S0956796807006612. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Z. M. Ariola, J. Maraist, M. Odersky, M. Felleisen, and P. Wadler. A call-by-need lambda calculus. In Proceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’95, pages 233–246, New York, NY, USA, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. ACM. ISBN 0-89791-692-1. doi: 10.1145/199448.199507.Google ScholarGoogle Scholar
  5. Z. M. Ariola, A. Bohannon, and A. Sabry. Sequent calculi and abstract machines. ACM Transactions on Programming Languages and Systems, 31(4):13:1–13:48, May 2009. ISSN 0164-0925. doi: 10.1145/1516507.1516508. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Z. M. Ariola, H. Herbelin, and A. Saurin. Classical call-by-need and duality. In Proceedings of the 10th International Conference on Typed Lambda Calculi and Applications, TLCA’11, pages 27–44, Berlin, Heidelberg, 2011. Springer-Verlag. ISBN 978-3-642-21690-9. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Z. M. Ariola, P. Downen, H. Herbelin, K. Nakata, and A. Saurin. Classical call-by-need sequent calculi: The unity of semantic artifacts. In Proceedings of the 11th International Conference on Functional and Logic Programming, FLOPS’12, pages 32–46, Berlin, Heidelberg, 2012. Springer-Verlag. ISBN 978-3-642-29821-9. doi: 10. 1007/978-3-642-29822-6_6. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. J. Breitner. Call arity. In Trends in Functional Programming - 15th International Symposium, TFP 2014, Soesterberg, The Netherlands, May 26-28, 2014. Revised Selected Papers, pages 34–50, 2014. doi: 10. 1007/978-3-319-14675-1_3.Google ScholarGoogle Scholar
  9. D. Coutts, R. Leshchinskiy, and D. Stewart. Stream fusion: From lists to streams to nothing at all. In Proceedings of the 12th ACM SIGPLAN International Conference on Functional Programming, ICFP ’07, pages 315–326, New York, NY, USA, 2007. ACM. ISBN 978-1-59593-815- 2. doi: 10.1145/1291151.1291199. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. P. Curien and H. Herbelin. The duality of computation. In Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming (ICFP ’00), Montreal, Canada, September 18-21, 2000, pages 233–243, 2000. doi: 10.1145/351240.351262. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. R. Cytron, J. Ferrante, B. K. Rosen, M. N. Wegman, and F. K. Zadeck. Efficiently computing static single assignment form and the control dependence graph. ACM Transactions on Programming Languages and Systems, 13(4):451–490, 1991. doi: 10.1145/115372.115320. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. M. Felleisen. On the expressive power of programming languages. Science of Computer Programming, 17(1-3):35–75, Dec. 1991. ISSN 0167-6423. doi: 10.1016/0167-6423(91)90036-W. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. M. Felleisen and D. P. Friedman. Control operators, the SECDmachine, and the λ-calculus. In M. Wirsing, editor, Formal Description of Programming Concepts III, pages 193–219. North Holland Press, Amsterdam, 1986.Google ScholarGoogle Scholar
  14. C. Flanagan, A. Sabry, B. F. Duba, and M. Felleisen. The essence of compiling with continuations. In Proceedings of the ACM SIGPLAN 1993 Conference on Programming Language Design and Implementation, PLDI ’93, pages 237–247, New York, NY, USA, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. ACM. ISBN 0-89791-598-4. doi: 10.1145/155090.155113.Google ScholarGoogle Scholar
  16. G. Gentzen. Investigations into logical deduction. In M. Szabo, editor, Collected papers of Gerhard Gentzen, pages 68–131. North-Holland, 1969.Google ScholarGoogle Scholar
  17. H. Herbelin. A lambda-calculus structure isomorphic to gentzenstyle sequent calculus structure. In Computer Science Logic, 8th International Workshop, CSL ’94, Kazimierz, Poland, September 25-30, 1994, Selected Papers, pages 61–75, 1994. doi: 10.1007/BFb0022247. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. H. Herbelin. Explicit substitutions and reducibility. Journal of Logic and Computation, 11(3):431–451, 2001. doi: 10.1093/logcom/11.3. 431.Google ScholarGoogle ScholarCross RefCross Ref
  19. M. Hofmann and T. Streicher. Continuation models are universal for lambda-mu-calculus. In Proceedings, 12th Annual IEEE Symposium on Logic in Computer Science, Warsaw, Poland, June 29 - July 2, 1997, pages 387–395, 1997. doi: 10.1109/LICS.1997.614964. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. G. Huet. The zipper. Journal of Functional Programming, 7(5):549– 554, Sept. 1997. ISSN 0956-7968. doi: 10.1017/S0956796897002864. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. R. A. Kelsey. A correspondence between continuation passing style and static single assignment form. In Papers from the 1995 ACM SIGPLAN Workshop on Intermediate Representations, IR ’95, pages 13–22, New York, NY, USA, 1995. ACM. ISBN 0-89791-754-5. doi: 10.1145/202529.202532. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. A. Kennedy. Compiling with continuations, continued. In Proceedings of the 12th ACM SIGPLAN International Conference on Functional Programming, ICFP ’07, pages 177–190, New York, NY, USA, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. ACM. ISBN 978-1-59593-815-2. doi: 10.1145/1291151.1291179.Google ScholarGoogle Scholar
  24. D. A. Kranz, R. Kelsey, J. Rees, P. Hudak, and J. Philbin. ORBIT: an optimizing compiler for Scheme. In Proceedings of the 1986 SIGPLAN Symposium on Compiler Construction, Palo Alto, California, USA, June 25-27, 1986, pages 219–233, 1986. doi: 10.1145/12276.13333. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. J. Launchbury. A natural semantics for lazy evaluation. In Proceedings of the 20th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’93, pages 144–154, New York, NY, USA, 1993. ACM. ISBN 0-89791-560-7. doi: 10.1145/158511.158618. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. R. Leißa, M. Köster, and S. Hack. A graph-based higher-order intermediate representation. In Proceedings of the 13th Annual IEEE/ACM International Symposium on Code Generation and Optimization, CGO ’15, pages 202–212, Washington, DC, USA, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. IEEE Computer Society. ISBN 978-1-4799-8161-8.Google ScholarGoogle Scholar
  28. A. Meyer and S. Cosmadakis. Semantical Paradigms: Notes for an Invited Lecture. Technical report, MIT Laboratory for Computer Science, 545 Technology Square, Cambridge, MA 02139, July 1988.Google ScholarGoogle Scholar
  29. G. Munch-Maccagnoni. Focalisation and classical realisability. In Proceedings of the 23rd CSL International Conference and 18th EACSL Annual Conference on Computer Science Logic, CSL’09/EACSL’09, pages 409–423, Berlin, Heidelberg, 2009. Springer-Verlag. ISBN 3-642-04026-8, 978-3-642-04026-9. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. G. Munch-Maccagnoni. Syntax and Models of a non-Associative Composition of Programs and Proofs. PhD thesis, Univ. Paris Diderot, 2013.Google ScholarGoogle Scholar
  31. C. Okasaki, P. Lee, and D. Tarditi. Call-by-need and continuationpassing style. Lisp and Symbolic Computation, 7(1):57–82, Jan. 1994. ISSN 0892-4635. doi: 10.1007/BF01019945. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. M. Parigot. Lambda-my-calculus: An algorithmic interpretation of classical natural deduction. In Proceedings of the International Conference on Logic Programming and Automated Reasoning, LPAR ’92, pages 190–201, London, UK, UK, 1992. Springer-Verlag. ISBN 3-540- 55727-X. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. 663989.Google ScholarGoogle Scholar
  34. S. L. Peyton Jones and J. Launchbury. Unboxed values as first class citizens in a non-strict functional language. In Proceedings of the 5th ACM Conference on Functional Programming Languages and Computer Architecture, pages 636–666, London, UK, UK, 1991. Springer-Verlag. ISBN 3-540-54396-1. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. S. L. Peyton Jones and A. L. M. Santos. A transformation-based optimiser for Haskell. Science of Computer Programming, 32(1-3): 3–47, Sept. 1998. ISSN 0167-6423. doi: 10.1016/S0167-6423(97) 00029-4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. S. L. Peyton Jones, A. Tolmach, and T. Hoare. Playing by the rules: rewriting as a practical optimisation technique in GHC. In 2001 Haskell Workshop. ACM SIGPLAN, September 2001.Google ScholarGoogle Scholar
  37. G. D. Plotkin. Call-by-name, call-by-value and the λ-calculus. Theoretical Computer Science, 1(2):125–159, 1975. doi: 10.1016/ 0304-3975(75)90017-1.Google ScholarGoogle ScholarCross RefCross Ref
  38. J.-C. Raoult and J. Vuillemin. Operational and semantic equivalence between recursive programs. Journal of the Association for Computing Machinery, 27(4):772–796, Oct. 1980. ISSN 0004-5411. doi: 10.1145/ 322217.322229. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. 322229.Google ScholarGoogle Scholar
  40. J. C. Reynolds. The discoveries of continuations. Lisp and Symbolic Computation, 6(3-4):233–248, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. J. C. Reynolds. User-defined types and procedural data structures as complementary approaches to data abstraction. In C. A. Gunter and J. C. Mitchell, editors, Theoretical Aspects of Object-oriented Programming, pages 13–23. MIT Press, Cambridge, MA, USA, 1994. ISBN 0-262- 07155-X. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. 186680.Google ScholarGoogle Scholar
  43. J. C. Reynolds. Definitional interpreters for higher-order programming languages. Higher-Order and Symbolic Computation, 11(4):363–397, Dec. 1998. ISSN 1388-3690. doi: 10.1023/A:1010027404223. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. A. Sabry and M. Felleisen. Reasoning about programs in continuationpassing style. In LISP and Functional Programming, pages 288–298, 1992. doi: 10.1145/141471.141563. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. A. L. M. Santos. Compilation by Transformation in Non-Strict Functional Languages. PhD thesis, University of Glasgow, 1995.Google ScholarGoogle Scholar
  46. T. Standish, D. Harriman, D. Kibler, and J. Neighbors. The Irvine program transformation catalogue. 1976.Google ScholarGoogle Scholar
  47. G. L. Steele, Jr. RABBIT: A compiler for SCHEME. Technical Report AITR-474, Massachusetts Institute of Technology, Artificial Intelligence Laboratory, 1978. Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. G. L. Steele, Jr. and G. J. Sussman. Lambda: The ultimate declarative. Memo AIM-379, Massachusetts Institute of Technology, Artificial Intelligence Laboratory, 1976. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. G. L. Steele, Jr. and G. J. Sussman. Lambda: The ultimate imperative. Memo AIM-353, Massachusetts Institute of Technology, Artificial Intelligence Laboratory, 1976. Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. G. J. Sussman and G. L. Steele, Jr. SCHEME: An interpreter for untyped lambda-calculus. Memo AIM-349, Massachusetts Institute of Technology, Artificial Intelligence Laboratory, 1975. Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. P. Wadler. Call-by-value is dual to call-by-name. In Proceedings of the Eighth ACM SIGPLAN International Conference on Functional Programming, ICFP ’03, pages 189–201, New York, NY, USA, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  52. ACM. ISBN 1-58113-756-7. doi: 10.1145/944705.944723.Google ScholarGoogle Scholar
  53. P. Wadler. Propositions as types. Communications of the ACM, 58(12): 75–84, Nov. 2015. ISSN 0001-0782. doi: 10.1145/2699407. Google ScholarGoogle ScholarDigital LibraryDigital Library
  54. N. Zeilberger. The Logical Basis of Evaluation Order and Pattern-Matching. PhD thesis, Carnegie Mellon University, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Sequent calculus as a compiler intermediate language

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!