Anko is a scriptable interpreter written in Go.
(Picture licensed under CC BY-SA 3.0, photo by Ocdp)
package main
import (
"fmt"
"log"
"github.com/mattn/anko/vm"
)
func main() {
env := vm.NewEnv()
err := env.Define("println", fmt.Println)
if err != nil {
log.Fatalf("Define error: %v\n", err)
}
script := `
println("Hello World :)")
`
_, err = env.Execute(script)
if err != nil {
log.Fatalf("Execute error: %v\n", err)
}
// output: Hello World :)
}
More examples are located in the GoDoc:
https://godoc.org/github.com/mattn/anko/vm
go get github.com/mattn/anko
go install github.com/mattn/anko
./anko script.ank
The master branch language and API may change at any time.
To mitigate breaking changes, please use tagged branches. New tagged branches will be created for breaking changes.
Yasuhiro Matsumoto (a.k.a mattn)