RiveScript has been rewritten in yet another programming language. This time it’s Google’s Go language!
I’ve just gotten to the point that I’m ready to announce it. So that means this module is considered beta status and I’d like some people to test it. Feature-wise it should be on par with all of the other versions of RiveScript; I ported over all the unit tests from the JavaScript version and they all passed.
Feature Highlights:
* Native support for running JavaScript object macros via otto (https://github.com/robertkrimen/otto). The JavaScript has full access to the Go RiveScript API. Macros should be shareable with the JS version of RiveScript!
* Support for Golang object macro handlers, but these need to be compiled into your bot with `SetSubroutine()` (Go isn’t a dynamic language and can’t compile its own code).
* It’s written in Go! So your bot can be compiled into a native executable on most platforms and it probably runs a lot faster than the other RiveScript implementations.
GitHub repo: https://github.com/aichaos/rivescript-go
Documentation:
* RiveScript Library: http://godoc.org/github.com/aichaos/rivescript-go
* RiveScript Stand-alone Interpreter: http://godoc.org/github.com/aichaos/rivescript-go/cmd/rivescript
* JavaScript Object Macros: http://godoc.org/github.com/aichaos/rivescript-go/lang/rivescript_js
Quick start, how to build the stand-alone interpreter:
1. Install Golang and set your $GOPATH (assuming it’s `~/go` for the rest of these steps)
2. `go get github.com/aichaos/rivescript-go`
3. `cd ~/go/src/github.com/aichaos/rivescript-go`
4. Quick testing: `go run cmd/rivescript/main.go eg/brain`
5. Build/install: `go install github.com/aichaos/rivescript-go/cmd/rivescript`
Future possibilities:
With Go v1.5, packages can be built as C-compatible shared objects (.so/.dll files). This means that RiveScript-Go should be linkable with many different programming languages, if they have an API for linking with C code. Examples include Perl, Python, Ruby, PHP, C#...
So this should be the last time I rewrite RiveScript from scratch. I’ll still support the other four implementations (Perl/Python/JS/Java), but any new languages will use a binding to the Go version. Also for the fun of it I’ll bind Python to Go and see how its performance compares to the native Python RiveScript.