Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiling Automerge JS to golang #15

Open
ghost opened this issue Apr 11, 2018 · 2 comments
Open

compiling Automerge JS to golang #15

ghost opened this issue Apr 11, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Apr 11, 2018

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

@ghost
Copy link
Author

ghost commented Apr 11, 2018

@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")})
}

@misha-plus
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant