New project gives developers DIY tools for creating dynamic languages

ZetaVM, from the creator of the Higgs compiler for JavaScript, enables easy construction of interpreted and JITed dynamic languages

New project provides DIY tools for creating dynamic languages

The creator of the Higgs experimental JavaScript compiler has announced a new project: a virtual machine for dynamic languages that supports existing dynamic languages or make it easy to build new ones.

In the long run, the project has an even more ambitious purpose: allowing developers to create software that can still be run as-is decades from now.

The project, called ZetaVM, provides both a virtual machine and a JIT compiler with built-in support for features found in dyamic languages—dynamic typing, for instance, or flexible data types like arrays or extensible objects.

ZetaVM and Higgs' creator, Maxime Chevalier-Boisvert, is a computer science researcher at Université de Montréal. According to the blog post introducing ZetaVM, the project is both her personal hobby and a way to "make creating new programming languages very accessible." Most people who have "mastered a language such as Python" can "create a language of their own, in less than 2,000 lines of code," Chevalier-Boisvert says. What's more, the language will come equipped with JIT optimizations for speed, much like PyPy for Python or LuaJIT for Lua.

The ease of use can be largely attributed to the relative simplicity of generating the code that ZetaVM runs. ZetaVM uses an intermediate representation (IR) that is highly human-readable and can be generated in a number of ways. Chevalier-Boisvert mentions using a Python parser to read in your custom language and generate a ZetaVM IR—but this is merely one example. She also provides her own synthetic language, Plush, with a parser implemented in C++, as an example that developers can build on and analyze.

Long-term goals for ZetaVM are twofold. First is to provide a robust set of tools that make it possible to develop a language, including a small set of core libraries for common operations such as file and console I/O, basic graphics and audio, and input device handling.

A package manager is also slated to become part of the VM, so versioned and immutable packages can be uploaded and shared. This isn't only for convenience; it's part of the second goal: enabling the building of software that can survive in the long term. "By freezing the core VM semantics and freezing submitted packages, we make it possible to write software that never breaks," Chevalier-Boisvert explains in her blog post. "My goal is to eventually freeze the IR and APIs provided by Zeta, so that code that runs on Zeta today might have a chance of still working in 20 years, without any changes."

ZetaVM's alpha version implements very little of this grand vision. Its current interpreter doesn't even feature the JIT, only a "naive interpreter" that is "dog slow, about 200K instructions per second." The plan is to eventually compile ZetaVM's human-readable IR into a lower-level internal IR, then create the JIT technology to operate on that code.

Copyright © 2017 IDG Communications, Inc.

How to choose a low-code development platform