Laurence Tratt – End-to-end language composition

After years of trying to build the perfect language, Laurence Tratt realizes that there is no such thing as the perfect language. This is why currently, he is working on language composition.

Composition is done on two things: Firstly composing the syntax and secondly the runtime.


Laurence argues that the only reasonable option is a structure editor (or, as he calls them: structure directed editors) Unfortunately though, developers really hate them, so he wants to make them look and feel like a text editor. The composition is done with ‘language boxes’ in which a different language can be parsed. In the ‘host’ language you don’t care about what it in the box, the lower parser takes care of that. Like here, where a SQL box is embedded.

2014-04-09 13.59.57

So, let’s assume this works. Now, we just have to run this thing 🙂


Most people use the JVM (or CLR) for this, because it has an API for composing languages. The problem works, but there is a ‘semantic mismatch’ if your language is not Java-like (say: Python) it is going to be slow, because the JVM is optimized for Java.

Laurence’s solution is meta-tracing virtual machines. The exact workings were too quick and technical for me,but the idea is to apply the technique of tracing JIT compilers to interpreters.

Update by Laurence himself

More info on Laurence’s research group website.


This post was visited 168 times.