article

Operational semantics for multi-language programs

Published:17 January 2007Publication History

Abstract

Inter-language interoperability is big business, as the success of Microsoft's .NET and COM and Sun's JVM show. Programming language designers are designing programming languages that reflect that fact --- SML#, Mondrian, and Scala, to name just a few examples, all treat interoperability with other languages as a central design feature. Still, current multi-language research tends not to focus on the semantics of interoperation features, but only on how to implement them efficiently. In this paper, we take first steps toward higher-level models of interoperating systems. Our technique abstracts away the low-level details of interoperability like garbage collection and representation coherence, and lets us focus on semantic properties like type-safety and observable equivalence.Beyond giving simple expressive models that are natural compositions of single-language models, our studies have uncovered several interesting facts about interoperability. For example, higher-order contracts naturally emerge as the glue to ensure that interoperating languages respect each other's type systems. While we present our results in an abstract setting, they shed light on real multi-language systems and tools such as the JNI, SWIG, and Haskell's stable pointers.

References

  1. M. Abadi, L. Cardelli, B. Pierce, and G. Plotkin. Dynamic typing in a statically typed language. ACM Transactions on Programming Languages and Systems, 13(2):237--268, April 1991.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. E. Barzilay and J. Clements. Laziness without all the hard work. In Workshop on Functional and Declarative Programming in Education (FDPE), 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. E. Barzilay and D. Orlovsky. Foreign interface for PLT Scheme. In Workshop on Scheme and Functional Programming, 2004.]]Google ScholarGoogle Scholar
  4. D. Beazley. Pointers, constraints, and typemaps. In SWIG 1.1 Users Manual. Available online: http://www.swig.org/Doc1.1/HTML/Typemaps.html.]]Google ScholarGoogle Scholar
  5. D. Beazley. SWIG: An easy to use tool for integrating scripting languages with C and C++. In 4th Tcl/Tk Workshop, pages 129--139, 1996. Available online: http://www.swig.org/papers/Tcl96/tcl96.html.]]Google ScholarGoogle Scholar
  6. N. Benton. Embedded interpreters. Journal of Functional Programming, 15:503--542, July 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. N. Benton and A. Kennedy. Interlanguage working without tears: Blending SML with Java. In ACM SIGPLAN International Conference on Functional Programming (ICFP), pages 126--137, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. N. Benton, A. Kennedy, and C. V. Russo. Adventures in interoperability: the SML.NET experience. In Proceedings of the 6th International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming (PPDP), pages 215--226, 2004.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. M. Blume. No-longer-foreign: Teaching an ML compiler to speak C "natively". In Workshop on Multi-Language Infrastructure and Interoperability (BABEL), 2001.]]Google ScholarGoogle Scholar
  10. L. Cardelli. Amber. In G. Cousineau, P.-L. Curien, and B. Robinet, editors, Combinators and functional programming languages, volume 242. Springer-Verlag, 1986.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. M. M. T. Chakravarty. C → HASKELL, or yet another interfacing tool. In International Workshop on Implementation of Functional Languages (IFL), 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. M. M. T. Chakravarty. The Haskell 98 foreign function interface 1.0, 2002. Available online: http://www.cse.unsw.edu.au/~chak/haskell/ffi/.]]Google ScholarGoogle Scholar
  13. C. Chambers and The Cecil Group. The Cecil language: Specification and rationale, version 3.2. Technical report, Department of Computer Science and Engineering, University of Washington, February 2004. Available online: http://www.cs.washington.edu/research/projects/cecil/pubs/cecil-spec.html.]]Google ScholarGoogle Scholar
  14. M. Felleisen. On the expressive power of programming languages. Science of Computer Programming, 17:35--75, 1991.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. M. Felleisen and R. Hieb. The revised report on the syntactic theories of sequential control and state. Theoretical Computer Science, 102:235--271, 1992. Original version in: Technical Report 89--100, Rice University, June 1989.]]Google ScholarGoogle Scholar
  16. R. B. Findler and M. Blume. Contracts as pairs of projections. In International Symposium on Functional and Logic Programming (FLOPS), 2006.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. R. B. Findler and M. Felleisen. Contracts for higher-order functions. In ACM SIGPLAN International Conference on Functional Programming (ICFP), 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. S. Finne, D. Leijen, E. Meijer, and S. Peyton Jones. Calling Hell from Heaven and Heaven from Hell. In ACM SIGPLAN International Conference on Functional Programming (ICFP), pages 114--125, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. K. Fisher, R. Pucella, and J. Reppy. A framework for interoperability. In Workshop on Multi-Language Infrastructure and Interoperability (BABEL), 2001.]]Google ScholarGoogle ScholarCross RefCross Ref
  20. C. Flanagan. Hybrid type checking. In ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), 2006.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. M. Furr and J. S. Foster. Checking type safety of foreign function calls. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 62--72, 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. A. D. Gordon and D. Syme. Typing a multi-language intermediate code. In ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), pages 248--260, 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. K. E. Gray, R. B. Findler, and M. Flatt. Fine grained interoperability through mirrors and contracts. In Conference on Object-Oriented Programming: Systems, Languages, and Applications (OOPSLA), 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. F. Henglein. Dynamic typing: Syntax and proof theory. Science of Computer Programming, 22(3):197--230, 1994.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. F. Henglein and J. Rehof. Safe polymorphic type inference for a dynamically typed language: translating Scheme to ML. In Proceedings of the Conference on Functional Programming Languages and Computer Architecture (FPCA), 1995.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. R. Ibrahim and C. Szyperski. The COMEL language. Technical Report FIT-TR-97-06, Faculty of Information Technology, Queensland University of Technology, Brisbane, Australia, 1997.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Jython. http://www.jython.org/.]]Google ScholarGoogle Scholar
  28. A. Kennedy. Securing the .NET programming model. Theoretical Computer Science, To appear. http://research.microsoft.com/~akenn/sec/.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. L. Kornstaedt. Alice in the land of Oz - an interoperability-based implementation of a functional language on top of a relational language. In Workshop on Multi-Language Infrastructure and Interoperability (BABEL), 2001.]]Google ScholarGoogle ScholarCross RefCross Ref
  30. J. Matthews and R. B. Findler. An operational semantics for R5RS Scheme. In Workshop on Scheme and Functional Programming, 2005.]]Google ScholarGoogle Scholar
  31. J. Matthews, R. B. Findler, M. Flatt, and M. Felleisen. A visual en-vironment for developing context-sensitive term rewriting systems. In Proceedings of the International Conference on Rewriting Techniques and Applications (RTA), 2004.]]Google ScholarGoogle ScholarCross RefCross Ref
  32. E. Meijer, N. Perry, and A. van Yzendoorn. Scripting .NET using Mondrian. In European Conference on Object-Oriented Programming (ECOOP), pages 150--164, London, UK, 2001. Springer-Verlag.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. P. Meunier and D. Silva. From Python to PLT Scheme. In Proceedings of the Fourth Workshop on Scheme and Functional Programming, pages 24--29, 2003.]]Google ScholarGoogle Scholar
  34. M. Odersky, P. Altherr, V. Cremet, B. Emir, S. Micheloud, N. Mihaylov, M. Schinz, E. Stenman, and M. Zenger. An Introduction to Scala. http://scala.epfl.ch/docu/files/ScalaIntro.pdf, 2005.]]Google ScholarGoogle Scholar
  35. A. Ohori and K. Kato. Semantics for communication primitives in an polymorphic language. In ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), pages 99--112, 1993.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. P. Pinto. Dot-Scheme: A PLT Scheme FFI for the .NET framework. In Workshop on Scheme and Functional Programming, November 2003.]]Google ScholarGoogle Scholar
  37. G. D. Plotkin. LCF considered as a programming language. Theoretical Computer Science, pages 223--255, 1977.]]Google ScholarGoogle Scholar
  38. R. Pucella. Towards a formalization for COM, part I: The primitive calculus. In Conference on Object-Oriented Programming: Systems, Languages, and Applications (OOPSLA), 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. N. Ramsey. Embedding an interpreted language using higher-order functions and types. In Interpreters, Virtual Machines and Emulators (IVME '03), pages 6--14, 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. J. Reppy and C. Song. Application-specific foreign-interface generation. In International Conference on Generative Programming and Component Engineering (GPCE), 2006.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. P. Steckler. MysterX: A Scheme toolkit for building interactive applications with COM. In Technology of Object-Oriented Languages and Systems (TOOL), pages 364--373, 1999. Available online: citeseer.ist.psu.edu/steckler99mysterx.html.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. V. Trifonov and Z. Shao. Safe and principled language interoperation. In European Symposium on Programming (ESOP), pages 128--146, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. A. Wright and M. Felleisen. A syntactic approach to type soundness. Information and Computation, pages 38--94, 1994. First appeared as Technical Report TR160, Rice University, 1991.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. S. Zdancewic, D. Grossman, and G. Morrisett. Principals in programming languages. In ACM SIGPLAN International Conference on Functional Programming (ICFP), 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Operational semantics for multi-language programs

      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

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 42, Issue 1
        Proceedings of the 2007 POPL Conference
        January 2007
        379 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/1190215
        Issue’s Table of Contents
        • cover image ACM Conferences
          POPL '07: Proceedings of the 34th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
          January 2007
          400 pages
          ISBN:1595935754
          DOI:10.1145/1190216

        Copyright © 2007 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 17 January 2007

        Check for updates

        Qualifiers

        • article

      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!