github.com/goplus/igop@v0.25.0/README.md (about) 1 # iGo+ The Go/Go+ Interpreter 2 3 [![Go1.18](https://github.com/goplus/igop/workflows/Go1.18/badge.svg)](https://github.com/goplus/igop/actions/workflows/go118.yml) 4 [![Go1.19](https://github.com/goplus/igop/workflows/Go1.19/badge.svg)](https://github.com/goplus/igop/actions/workflows/go119.yml) 5 [![Go1.20](https://github.com/goplus/igop/workflows/Go1.20/badge.svg)](https://github.com/goplus/igop/actions/workflows/go120.yml) 6 [![Go1.21](https://github.com/goplus/igop/workflows/Go1.21/badge.svg)](https://github.com/goplus/igop/actions/workflows/go121.yml) 7 [![Go1.22](https://github.com/goplus/igop/workflows/Go1.22/badge.svg)](https://github.com/goplus/igop/actions/workflows/go122.yml) 8 [![Go Reference](https://pkg.go.dev/badge/github.com/goplus/igop.svg)](https://pkg.go.dev/github.com/goplus/igop) 9 10 11 ### Go Version 12 13 - Go1.18 ~ Go1.22 14 - macOS Linux Windows WebAssembly GopherJS and more. 15 16 ### ABI 17 18 support ABI0 and ABIInternal 19 20 - ABI0 stack-based ABI 21 - ABIInternal [register-based Go calling convention proposal](https://golang.org/design/40724-register-calling) 22 23 - Go1.17: amd64 24 - Go1.18: amd64 arm64 ppc64/ppc64le 25 - Go1.19: amd64 arm64 ppc64/ppc64le riscv64 26 - Go1.20: amd64 arm64 ppc64/ppc64le riscv64 27 - Go1.21: amd64 arm64 ppc64/ppc64le riscv64 28 - Go1.22: amd64 arm64 ppc64/ppc64le riscv64 29 30 ### Generics 31 32 - support generics (Go1.18 ~ Go1.22) 33 - support [Go1.20 nested type-parameterized declarations](https://github.com/golang/go/blob/master/test/typeparam/nested.go) on Go1.18/Go1.19 (Experimental) 34 35 ### runtime.GC 36 37 `igop.Mode ExperimentalSupportGC` 38 39 experimental support runtime.GC and runtime.SetFinalizer 40 41 ### install igop command line 42 43 Go version < 1.17: 44 45 ```shell 46 go get -u github.com/goplus/igop/cmd/igop 47 ``` 48 49 Go version >= 1.17: 50 51 ```shell 52 go install github.com/goplus/igop/cmd/igop@latest 53 ``` 54 55 ### igop command 56 57 ``` 58 igop # igop repl mode 59 igop run # run a Go/Go+ package 60 igop build # compile a Go/Go+ package 61 igop test # test a package 62 igop verson # print version 63 igop export # export Go package to igop builtin package 64 ``` 65 66 ### igop run mode 67 ``` 68 Usage: igop run [build flags] [package] [arguments...] 69 -exp-gc 70 experimental support runtime.GC 71 -mod value 72 module download mode to use: readonly, vendor, or mod. 73 -ssa 74 print SSA instruction code 75 -ssa-trace 76 trace SSA interpreter code 77 -tags value 78 a comma-separated list of build tags to consider satisfied during the build 79 -v print the names of packages as they are compiled. 80 -x print the commands. 81 ``` 82 83 ### igop repl mode 84 85 ```shell 86 igop # run repl mode, support Go/Go+ 87 igop repl # run repl mode, support Go/Go+ 88 igop repl -go # run repl mode, disable Go+ syntax 89 ``` 90 91 ### igop test unsupport features 92 93 - test -fuzz 94 - test -cover 95 96 ### igop demo 97 98 #### go js playground (gopherjs) 99 100 - <https://jsplay.goplus.org/> 101 - <https://github.com/goplusjs/play> 102 103 #### go repl playground (gopherjs/wasm) 104 105 - <https://repl.goplus.org/> 106 - <https://github.com/goplusjs/repl> 107 108 #### ispx 109 110 <https://github.com/goplus/ispx> 111 112 #### run simple Go source demo 113 114 ```go 115 package main 116 117 import ( 118 "github.com/goplus/igop" 119 _ "github.com/goplus/igop/pkg/fmt" 120 ) 121 122 var source = ` 123 package main 124 import "fmt" 125 type T struct {} 126 func (t T) String() string { 127 return "Hello, World" 128 } 129 func main() { 130 fmt.Println(&T{}) 131 } 132 ` 133 134 func main() { 135 _, err := igop.RunFile("main.go", source, nil, 0) 136 if err != nil { 137 panic(err) 138 } 139 } 140 ``` 141 142 #### run simple Go+ source demo 143 144 ```go 145 package main 146 147 import ( 148 "github.com/goplus/igop" 149 _ "github.com/goplus/igop/gopbuild" 150 ) 151 152 var gopSrc string = ` 153 fields := [ 154 "engineering", 155 "STEM education", 156 "and data science", 157 ] 158 159 println "The Go+ language for", fields.join(", ") 160 ` 161 162 func main() { 163 _, err := igop.RunFile("main.gop", gopSrc, nil, 0) 164 if err != nil { 165 panic(err) 166 } 167 } 168 ``` 169 170 #### igop more demo 171 172 <https://github.com/visualfc/igop_demo>