Programming Language Composition
air.mozilla.org
air.mozilla.org
- An editor which allows near-arbitrary nesting of languages (for example, SQL in Python in HTML, then exporting the whole thing as Python code to generate a web-page from a database query)
- A "bridge" interpreter implemented in RPython that allows communication between the PyPy (Python) and HippyVM (PHP) runtimes.
- As an example, they had a 'hello world' script where "hello" was a global variable in PHP, "world" was a local variable in a Python function, and the string concatenation was done by a PHP lambda defined inside the Python function, and then invoked by Python. Note that PHP doesn't support dynamic scoping, so that was added by their glue code.
- The combined VM, after being processed by RPython into a tracing JIT, could process monolingual PHP code about as fast as HippyVM (still many times faster than ZEND PHP).