gijit / gi

gijit is a just-in-time trace-compiled golang REPL. Standing on the shoulders of giants (GopherJS and LuaJIT).
Other
320 stars 17 forks source link

Compiles to Lua? #59

Open Merith-TK opened 3 years ago

Merith-TK commented 3 years ago

So I came here form a page of libraries and languages that compile to Lua. Is there a way I can import Lua libraries in this code?

glycerine commented 3 years ago

Sure, but this project hasn't been maintained in a couple of Go versions, so it will need some love. I don't have time to maintain it atm.

 $ gi -r -np
====================
gijit: a go interpreter, just-in-time.
====================
https://github.com/glycerine/gi
Copyright (c) 2018, Jason E. Aten. All rights reserved.
License: 3-clause BSD. See the LICENSE file at
https://github.com/glycerine/gi/blob/master/LICENSE
====================
  [ gijit/gi is an interactive Golang environment,
    also known as a REPL or Read-Eval-Print-Loop.]
  [ at the gi> prompt, type ctrl-d to exit.]
  [ at the gi> :?   or :help for help.]
  [ $ gi -h for flag help, when first launching gijit.]
  [ $ gi -q to start quietly, without this banner.]
====================
built: '2020-12-10T20:27:47-0600'
last-git-commit-hash: '9e5c49a57ac73ee1ed60df09091db7a90c67d32c'
nearest-git-tag: 'v1.9.7'
git-branch: 'master'
go-version: 'go_version_go1.15.6_darwin/amd64'
luajit-version: 'LuaJIT_2.1.0-beta3+jea-int64-additions'
==================
loading LuaJIT vm without Luar.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x475b5a3]

goroutine 1 [running, locked to thread]:
github.com/glycerine/gi/pkg/compiler.(*IncrState).EnableImportsFromLua(0xc0003645c0)
        /users/jaten/go/src/github.com/glycerine/gi/pkg/compiler/import.go:131 +0x263
github.com/glycerine/gi/pkg/compiler.NewIncrState(0xc0002c2440, 0xc0002c2420, 0x0)
        /Users/jaten/go/src/github.com/glycerine/gi/pkg/compiler/translate.go:85 +0x354
github.com/glycerine/gi/pkg/compiler.NewRepl(0xc0002c2420, 0x36a)
        /Users/jaten/go/src/github.com/glycerine/gi/pkg/compiler/repl_luajit.go:138 +0x79
github.com/glycerine/gi/pkg/compiler.(*GIConfig).LuajitMain(0xc0002c2420)
        /Users/jaten/go/src/github.com/glycerine/gi/pkg/compiler/repl_luajit.go:88 +0x38
main.main()
        /Users/jaten/go/src/github.com/glycerine/gi/cmd/gi/repl.go:59 +0x22b
$