An ECMAScript 2018 (ES9) implementation in Go
Pure Go ECMAScript interpreter.
Gojis is an implementation of ECMAScript 2018 (ES 9). It basically is a JavaScript VM, just like Goja or Otto. The documentation can be found here.
Goja and Otto are both stuck at implementing most features of ES 5.1. This implementation aims to support ES 9, and, after that maybe even ES 10 and later.
The Gojis VM can be run as a standalone, or you can embed it into your Go application by using the API. Go get it with
go get -u github.com/gojisvm/gojis
// FIXME: the API is in draft mode, this is subject to change at any time
vm := gojis.NewVM()
vm.SetFunction("greet", func(gojis.Args) gojis.Object {
vm.Eval(`console.log("Hello World!");`)
return nil
})
vm.Eval(`greet();`)
/*
prints:
Hello World!
*/
$ gojis test.js
Hello, World!
$ gojis ./src
Hello, World! from test1
Hello, World! from test2
Hello, World! from test3
Hello, World! from test4
$ docker run -d -v ./src:/src gojisvm/gojis:latest
Hello, World! from test1
Hello, World! from test2
Hello, World! from test3
Hello, World! from test4
For more documentation, please have a look at the API documentation.
The primary goal of this project is to have fun coding, as I love to code, but thinking about system designs and architectures is difficult. The ECMAScript language specification (which can be found in /docs
), takes care of most of these things already, so a contributor can really focus on implementation and optimization.
Another goal I am trying to achieve is, to provide the Go community with a JavaScript VM that supports at least ES 6 features. Goja and Otto are both stuck at implementing ES 5.1, but this implementation does exactly that.
There is a milestone to keep track of the implementation progress of ES 9.