Launching Wagon, a WebAssembly interpreter in Go

Description

Go is an open-source language with builtin primitives to easily handle concurrency. It is now the building block of many cloud-based companies and is considered as the “language for the cloud”. (e.g: Docker, Kubernetes, …) Go was explicitly designed to address software engineering at scale, and is thus a natural fit for many HEP use cases. Indeed, Go has already great numerical and scientific libraries (for matrix operations, plotting, statistical analyses, graphs traversal, etc…) regrouped under the Gonum organization. Go can also be used from Jupyter thanks to the gophernotes kernel developed by the gopherdata data science community.

However, the interpreter used by gophernotes to turn Go into a great data exploration environment is not a real read-eval-print-loop (REPL): it just recompiles snippets of Go code on the fly. While this workaround is very serviceable, it carries its own set of issues, mainly with code that has side-effects.

This project intends to create the foundations for a Go interpreter, written in Go, for Go. Writing an interpreter is a lot of work and is a daunting task. The main development of this project will focus on creating the needed tooling (libraries and executables) to be able to consume WebAssembly bytecode (wasm) and interpret it. A package will be developed in Go to decode wasm binary files and display their sections, information and content. Another package will then implement a simple stack based interpreter, loading wasm files interactively and executing simple functions. The creation of these wasm bytecode modules by the Go toolchain is out of the scope of this project.

Task ideas

Expected results

An interpreter that can interpret a wasm bytecode file containing the bytecode equivalent of:

package main

func add(i, j int) int {
	return i+j
}

func main() {
	i := 42
	j := 666
	println("42+666=", add(i,j))
}

Requirements

Go language, git.

Mentors

Corresponding Project

Participating Organizations