Fine-grained Language Composition: A Case Study

Authors Edd Barrett, Carl Friedrich Bolz, Lukas Diekmann, Laurence Tratt

Thumbnail PDF


  • Filesize: 0.92 MB
  • 27 pages

Document Identifiers

Author Details

Edd Barrett
Carl Friedrich Bolz
Lukas Diekmann
Laurence Tratt

Cite AsGet BibTex

Edd Barrett, Carl Friedrich Bolz, Lukas Diekmann, and Laurence Tratt. Fine-grained Language Composition: A Case Study. In 30th European Conference on Object-Oriented Programming (ECOOP 2016). Leibniz International Proceedings in Informatics (LIPIcs), Volume 56, pp. 3:1-3:27, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2016)


Although run-time language composition is common, it normally takes the form of a crude Foreign Function Interface (FFI). While useful, such compositions tend to be coarse-grained and slow. In this paper we introduce a novel fine-grained syntactic composition of PHP and Python which allows users to embed each language inside the other, including referencing variables across languages. This composition raises novel design and implementation challenges. We show that good solutions can be found to the design challenges; and that the resulting implementation imposes an acceptable performance overhead of, at most, 2.6x.
  • JIT
  • tracing
  • language composition


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Kenneth R. Anderson and Duane Rettig. Performing Lisp analysis of the Fannkuch benchmark. Lisp Pointers, 7(4):2-12, Oct 1994. Google Scholar
  2. Vasanth Bala, Evelyn Duesterwald, and Sanjeev Banerjia. Dynamo: A transparent dynamic optimization system. In PLDI, pages 1-12, Jun 2000. Google Scholar
  3. Edd Barrett, Carl Friedrich Bolz, and Laurence Tratt. Approaches to interpreter composition. COMLAN, 44(C), March 2015. Google Scholar
  4. Michael Bebenita, Florian Brandner, Manuel Fahndrich, Francesco Logozzo, Wolfram Schulte, Nikolai Tillmann, and Herman Venter. SPUR: A trace-based JIT compiler for CIL. In OOPSLA, pages 708-725, Mar 2010. Google Scholar
  5. Carl Friedrich Bolz, Lukas Diekmann, and Laurence Tratt. Storage strategies for collections in dynamically typed languages. In OOPSLA, pages 167-182, Oct 2013. Google Scholar
  6. Carl Friedrich Bolz and Laurence Tratt. The impact of meta-tracing on VM design and implementation. Science of Computer Programming, 98, Part 3:408-421, Feb 2015. Google Scholar
  7. Martin Bravenboer, Karl Trygve Kalleberg, Rob Vermaas, and Eelco Visser. Stratego/XT 0.17. A language and toolset for program transformation. SCICO, 72(1–2):52 - 70, 2008. Google Scholar
  8. Luca Cardelli, Florian Matthes, and Martín Abadi. Extensible grammars for language specialization. In Database Programming Languages, pages 11-31, Aug 1993. Google Scholar
  9. Craig Chambers, David Ungar, and Elgin Lee. An efficient implementation of SELF a dynamically-typed object-oriented language based on prototypes. In OOPSLA, Sep 1989. Google Scholar
  10. Thomas E. Cheatham. Motivation for extensible languages. SIGPLAN, 4(8):45-49, Aug 1969. Google Scholar
  11. Lukas Diekmann and Laurence Tratt. Eco: A language composition editor. In SLE, pages 82-101, Sep 2014. Google Scholar
  12. Daniele Filaretti and Sergio Maffeis. An executable formal semantics of PHP. In ECOOP, pages 567-592, 2014. Google Scholar
  13. Andreas Gal, Christian W. Probst, and Michael Franz. HotpathVM: an effective JIT compiler for resource-constrained devices. In VEE, pages 144-153, Jun 2006. Google Scholar
  14. Kathryn E. Gray. Safe cross-language inheritance. In ECOOP, pages 52-75, jul 2008. Google Scholar
  15. Kathryn E. Gray, Robert Bruce Findler, and Matthew Flatt. Fine-grained interoperability through mirrors and contracts. In OOPSLA, pages 231-245, Oct 2005. Google Scholar
  16. Mathias Grimmer, Chris Seaton, Thomas Würthinger, and Hanspeter Mössenböck. Dynamically composing languages in a modular way: Supporting C extensions for dynamic languages. In Modularity, March 2015. Google Scholar
  17. Matthias Grimmer, Chris Seaton, Roland Schatz, Thomas Würthinger, and Hanspeter Mössenböck. High-performance cross-language interoperability in a multi-language runtime. In DLS, pages 78-90, 2015. Google Scholar
  18. Dan Ingalls, Ted Kaehler, John Maloney, Scott Wallace, and Alan Kay. Back to the future: the story of Squeak, a practical Smalltalk written in itself. In OOPSLA, pages 318-326, Oct 1997. Google Scholar
  19. Edgar T. Irons. Experience with an extensible language. CACM, 13(1):31-40, Jan 1970. Google Scholar
  20. Gregory F. Johnson and C. N. Fischer. A meta-language and system for nonlocal incremental attribute evaluation in language-based editors. In POPL, pages 141-151, Jan 1985. Google Scholar
  21. Tomas Kalibera and Richard Jones. Quantifying performance changes with effect size confidence intervals. Technical Report 4-12, University of Kent, Jun 2012. Google Scholar
  22. Richard A. Kelsey and Jonathan A. Rees. A tractable Scheme implementation. Lisp Symb. Comput., 7(4):315-335, Dec 1994. Google Scholar
  23. Jacob Matthews and Robert Bruce Findler. Operational semantics for multi-language programs. TOPLAS, 31(3):12:1-12:44, Apr 2009. Google Scholar
  24. James George Mitchell. The design and construction of flexible and efficient interactive programming systems. PhD thesis, Carnegie Mellon University, Jun 1970. Google Scholar
  25. Melissa E. O'Neil. PCG: A family of simple fast space-efficient statistically good algorithms for random number generation, 2015. Google Scholar
  26. Joe Gibbs Politz, Alejandro Martinez, Matthew Milano, Sumner Warren, Daniel Patterson, Junsong Li, Anand Chitipothu, and Shriram Krishnamurthi. Python: The full Monty. In OOPSLA, pages 217-232, 2013. Google Scholar
  27. Michael Sannella, John Maloney, Bjorn Freeman-Benson, and Alan Borning. Multi-way versus one-way constraints in user interfaces: Experience with the DeltaBlue algorithm. SPE, 23(5):529-566, 1993. Google Scholar
  28. Aibek Sarimbekov, Andrej Podzimek, Lubomir Bulej, Yudi Zheng, Nathan Ricci, and Walter Binder. Characteristics of dynamic JVM languages. In VMIL, pages 11-20, Oct 2013. Google Scholar
  29. Gregory T. Sullivan, Derek L. Bruening, Iris Baron, Timothy Garnett, and Saman Amarasinghe. Dynamic native optimization of interpreters. In IVME, pages 50-57, Jun 2003. Google Scholar
  30. Kevin J. Sullivan, Mark Marchukov, and John Socha. Analysis of a conflict between aggregation and interface negotiation in Microsoft’s component object model. TOSE, 25(4):584-599, Jul 1999. Google Scholar
  31. Laurence Tratt. Domain specific language implementation via compile-time meta-programming. TOPLAS, 30(6):1-40, Oct 2008. Google Scholar
  32. Thomas Würthinger, Christian Wimmer, Andreas Wöß, Lukas Stadler, Gilles Duboscq, Christian Humer, Gregor Richards, Doug Simon, and Mario Wolczko. One VM to rule them all. In Onward!, pages 187-204, 2013. Google Scholar
  33. Alexander Yermolovich, Christian Wimmer, and Michael Franz. Optimization of dynamic languages using hierarchical layering of virtual machines. In DLS, pages 79-88, Oct 2009. Google Scholar
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail