Overview

In this blog post, I will talk about my experience with ZetaVM. Firstly, I will briefly introduce you to what this project is and what are its goals. Then, I will talk about how and why I started contributing to this project and why I love it. Finally, I will shortly explain my contributions.

What is ZetaVM

ZetaVM logo

This part is going to be about me trying to explain what ZetaVM is to you. I may say slightly incorrect stuff, if you spot them please let me know! You can find the code for ZetaVM at https://github.com/zetavm/zetavm

ZetaVM is a project started by an awesome human being named Maxime. As part of her Ph.D. she has developed a new technique that can make languages like Python or JavaScript run faster. In fact, these 2 languages share a common feature: being dynamically typed. This means that types are checked at runtime, while your code is executed. Her new technique can reduce the amount of type checking that needs to happen, thus making your program run faster.

ZetaVM will have full support for this feature in future, but it’s much more than that. It’s a VM especially tailored for dynamically typed languages.

Let me first define what some of this terms mean. A VM, in the programming language world, is a piece of software which can interpret (in different ways) a set of instructions. For example, the JVM is, as the name suggests, a VM. It takes Java Bytecode, which is its own set of instructions, and then run it.

What does it mean that ZetaVM is particularly tailored for dynamically typed languages? It means that the instructions it expects can make a new dynamic language easy to implement. For example, arrays are not limited to contain only elements of the same type at the VM level.

In my opinion, ZetaVM can be an awesome platform to experiment with creating your own programming language and make it also decently fast. Not only that, in the future, the project will have a package manager, that not only will allow sharing packages between users (which may use different languages that run on Zeta) but also it will make it possible to distribute a language as a package! It will mean that people could start coding in a new language by just installing a new package for the VM.

At the time of writing, there is one language, that I would define as usable, that runs on top of the VM and it is called Plush. It is a language in between JavaScript and Lua. There are other languages that have been started, but they are not really usable at this point in time.

How I started and why I love the project

Back in May, after having finished my second year of University, I was looking to contribute to some projects that were related to programming languages. I checked out more known projects like LLVM and similar, but at first (this was just my impression and it’s definitely not a true fact) glance they appeared to be slightly intimidating. I’ll be honest here and the fact that LLVM was not on GitHub slightly let me down (but they are now apparently moving to it, hooray!). I then, somehow, I think through Twitter, discovered ZetaVM and I opened an issue asking how a newbie could help.

Maxime replied mentioning different possible enhancement that I could work on. I picked up one and I started to delve into the codebase, in order to understand what I would need to do and I slowly began to understand what I had to do. I really want to stress here that ZetaVM code is one of the best codebases I’ve worked on (not that I’ve worked on a lot of them), but I found that it included a good amount of comments that facilitated my understanding of the program.

I’m now still contributing to this project and I ended up being part of the organization on GitHub (which I’m incredibly happy about). I love this project because of the people that work on it. I’ve learned a lot and I continue to do so, which is amazing. The project aims to empower people to experiment freely in creating new languages, with little to no hassle, which in my opinion is amazing. Moreover, part of the project philosophy is to experiment with new or different approaches, mainly because it’s a project which is meant to be fun and interesting for the people working on it!

My contributions

As I mentioned, I contributed to ZetaVM and I will now try to briefly explain how. I may, in the future, write more in details about some of my work to this project. Please let me know what you would be interested in knowing!

After having asked how I could help, my main aim was to introduce into ZetaVM float support. This would have allowed having better handling of graphics and sound related code. In order to do so, I took inspiration from the pieces of code that handled integer and slowly created similar ones for floats. When I finished integrating floats in the VM, I then moved to add supports for them into Plush.

Then, I’ve created a core library which exposes an audio output API. This piece involved wrapping a C++ library and exposing it as a module in the VM. There were some examples of this already, so again, I had to understand them and reuse what I learned to accomplish my goals.

In the meanwhile, I’ve also set up TravisCI and AppVeyor, so that the project could make use of the wonders of continuous integration. This turned out to be slightly challenging, especially on Travis, due to the version of GCC installed in their Linux machines. I ended up using docker in order to test on Linux using both GCC and clang.

After, I tried to implement my own language on top of ZetaVM. My main aim for this was to learn how to actually do this and, in the meanwhile, write this in Python. While doing this, I’ve emulated most of the code that powers Plush, thus making my language relatively similar to it. Meanwhile, this is the first language whose front-end (this term refers to that piece of software that reads the source code and translate it to a set of instructions for the VM) is written in Python and I plan to make extract some utilities in the form of libraries, such that it will make it even easier to write a front-end in Python.

Finally, I’m now writing a very simple Garbage Collector for the VM. It’s still not working and I need to work more on it, but I’m confident it will work at some point. I may write about it in a future blog post!

Final words

I would like to say a huge thank you to Maxime. She really had an impact on my life as a developer and I learned so much thanks to her directly and indirectly.