Skip to content

goplus/ixgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,773 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iXGo The Go/XGo Interpreter

Build Status Go Reference

A fast and fully compatible Go language interpreter.

Go Version

  • Go1.24 ~ Go1.26
  • macOS Linux Windows WebAssembly.

ABI

Generics

  • support typeparams
  • support alias typeparams

install ixgo command line

go install github.com/goplus/ixgo/cmd/ixgo@latest

install ixgo export command line

go install github.com/goplus/ixgo/cmd/qexp@latest

ixgo command

ixgo             # ixgo repl mode
ixgo run         # run a Go/XGo package
ixgo build       # compile a Go/XGo package
ixgo test        # test a package
ixgo verson      # print version
ixgo export      # export Go package to ixgo builtin package

ixgo run mode

Usage: ixgo run [build flags] [package] [arguments...]
  -exp-gc
    	experimental support runtime.GC
  -mod value
    	module download mode to use: readonly, vendor, or mod.
  -ssa
    	print SSA instruction code
  -ssa-trace
    	trace SSA interpreter code
  -tags value
    	a comma-separated list of build tags to consider satisfied during the build
  -v	print the names of packages as they are compiled.
  -x	print the commands.

ixgo repl mode

ixgo                       # run repl mode, support Go/XGo
ixgo repl                  # run repl mode, support Go/XGo
ixgo repl -go              # run repl mode, disable XGo syntax

ixgo test unsupport features

  • test -fuzz
  • test -cover

ixgo demo

The XGo Playground (WebAssembly)

The XGo REPL Playground (WebAssembly)

run simple Go source demo

package main

import (
	"github.com/goplus/ixgo"
	_ "github.com/goplus/ixgo/pkg/fmt"
)

var source = `
package main

import "fmt"

func main() {
	fmt.Println("Hello, World")
}
`

func main() {
	_, err := ixgo.RunFile("main.go", source, nil, 0)
	if err != nil {
		panic(err)
	}
}

run simple XGo source demo

package main

import (
	"github.com/goplus/ixgo"
	_ "github.com/goplus/ixgo/xgobuild"
)

var source = `
fields := [
	"engineering",
	"STEM education", 
	"and data science",
]

echo "The XGo language for", fields.join(", ")
`

func main() {
	_, err := ixgo.RunFile("main.xgo", source, nil, 0)
	if err != nil {
		panic(err)
	}
}

install ixgo command line linkname mode

go install -tags linknamefix -ldflags="-checklinkname=0" github.com/goplus/ixgo/cmd/ixgo@latest

use runtime linkname for faster performance iter.Pull/iter.Pull2

ixgo more demo

https://github.com/visualfc/ixgo_demo