godzilla
godzilla copied to clipboard
compiling Automerge JS to golang
Would you have time to have a quick look at this code and tell me if you see it as clean enough to port ?
Its a CRDT package written in JS.
https://github.com/automerge/automerge/tree/master/src
@jingweno I got the basic setup going.
My aim with all this is to convert some JS code to golang with no dependencies in the final golang code.
I might not fully understand but why is outputted golang code dependent on "github.com/jingweno/godzilla/runtime".
Its not really a transpiler, but a runtime reflection / AST based interpreter ?
Please let me know
echo "console.log('Hello, Godzilla')" | $(GODZILLA_BINPATH)/godzilla build --debug --output
package main
import (
. "github.com/jingweno/godzilla/runtime"
)
func main() {
global := NewDefaultContext().Global
_ = global
// line 1: console.log("Hello, Godzilla")
Console_Log([]Object{JSString("Hello, Godzilla")})
}
As you see this is Golang source code with no interpretation. Just calling Console_Log and wrapping the JS types to corresponding types from Godzilla. I'm not looked the code of this library, just look to the example which you mentioned.