Golang->Haxe->CPP/CSharp/Java/JavaScript transpiler

TARDIS Go -> Haxe transpiler

Haxe -> C++ / C# / Java / JavaScript

Build Status GoDoc status

Project status: a non-working curiosity, development currently on-ice

The advent of Go 1.5, with support for both iOS and Android, together with GopherJS, mean that the cross-platform UI objectives of this project are likely to soon be redundant, as libraries to achieve this can now be written directly in Go. The author has therefore paused development of the Haxe aspect of this project, freezing the runtime at Go 1.4. With the advent of Go 1.6, the code compiles but the tests no-longer pass.

All of the core Go language specification is implemented, including single-threaded goroutines and channels. However the package "reflect", which is mentioned in the core specification, is not yet fully supported.

Goroutines are implemented as co-operatively scheduled co-routines. Other goroutines are automatically scheduled every time there is a channel operation or goroutine creation (or call to a function which uses channels or goroutines through any called function). So loops without channel operations may never give up control. The function runtime.Gosched() provides a convenient way to allow other goroutines to run.

Well over half of the standard packages pass their tests for all targets.

The GOOS for TARDISgo is 'nacl', complete with an in-memory file system. However please note that NaCl provides no access to traditional networking. Go programs written for TARDISgo must use Haxe APIs to access host OS functionality.

A start has been made on the automated integration with Haxe libraries, but this is incomplete and the API unstable, see the haxe/hx directory and gohaxelib repository for the story so far.

The code is developed and tested on OS X 10.10.2, using Go 1.5rc1 and Haxe 3.2.0. The short CI test runs on 64-bit Ubuntu. No other platforms are currently regression tested.

Please note that the Haxe compiler may require in excess of 2Gb of memory to compile a non-trivial program to Java or C#.

To see a handful of live visual examples of code generated by this project in operation, please see the top and right-hand-side of tardisgo.github.io.

Installation and use:

go get -u github.com/tardisgo/tardisgo

If tardisgo is not installing and there is a green "build:passing" icon at the top of this page, please e-mail Elliott!

To translate Go to Haxe, from the directory containing your .go files type the command line:

tardisgo yourfilename.go 

A large number of .hx files will be created in the tardis subdirectory, of which Go.hx contains the entry-point. The use of a file per Haxe class makes second and subsequent compilations using C++ much faster, as only the altered classes are recompiled.

To run your transpiled code you will first need to install Haxe, version 3.2.0.

Then to run the tardis/Go.hx file generated above, for example in JavaScript, type the command lines:

haxe -main tardis.Go -cp tardis -dce full -D uselocalfunctions -js tardis/go.js
node < tardis/go.js

... or whatever Haxe compilation options you want to use. See the tgoall.sh script for simple examples. Note that in this example "-dce full" causes Haxe to do dead code elimination and that "-D uselocalfunctions" is a tardisgo haxe flag to generate JS code that is more likely to be optimized by V8.

The default memory model is fast, but requires more memory than you might expect (an int per byte) and only allows some unsafe pointer usages. If your code uses unsafe pointers to re-use memory as different types (say writing a float64 but reading back a uint64), there is a Haxe compilation flag for "fullunsafe" mode (this is slower, but has a smaller memory footprint and allows most unsafe pointers to be modeled accurately). In JS fullunsafe uses the dataview method of object access, for other targets it simulates memory access. Fullunsafe is little-endian only at present and pointer arithmetic (via uintptr) will panic. A command line example:

tardisgo mycode.go
haxe -main tardis.Go -cp tardis -D fullunsafe -js tardis/go-fu.js
node < tardis/go-fu.js

While on the subject of JS, the closure compiler seems to work, but only using the default "SIMPLE_OPTIMIZATIONS" option. It currently generates a large number of warnings.

The in-memory filesystem used by the nacl target is implemented, it can be pre-loaded with files by using the haxe command line flag "-resource" with the name "local/file/path/a.txt@/nacl/file/path/a.txt" thus (for example in JS):

tardisgo your_code_using_package_os.go
haxe -main tardis.Go -cp tardis -js tardis/go.js -resource testdata/config.xml@/myapp/static/config.xml
node < tardis/go.js

To add more than one file, use multiple -resource flags (the haxe ".hxml" compiler parameter file format can be helpful here). The files are stored as part of the executable code, in a target-specific way. The only resources that will be loaded are those named with a leading "/". A log file of the load process can be found at "/fsinit.log" in the in-memory file-system.

To load a zipped file system (very slow to un-zip, but useful for testing) use go code syscall.UnzipFS("myfs.zip") and include -resource myfs.zip on the haxe command line.

To add Go build tags, use the "-tags 'name1 name2'" tardisgo compilation flag. Note that particular Go build tags are required when compiling for OpenFL using the pre-built Haxe API definitions.

Use the "-debug" tardisgo compilation flag to instrument the code and add automated comments to the Haxe. When you experience a panic in this mode the latest Go source code line information and local variables appears in the stack dump. For the C++ & Neko (--interp) targets, a very simple debugger is also available by using the "-D godebug" Haxe flag, for example to use it in C++ type:

tardisgo -debug myprogram.go
haxe -main tardis.Go -cp tardis -dce full -D godebug -cpp tardis/cpp
./tardis/cpp/Go

To get a list of commands type "?" followed by carriage return, after the 1st break location is printed (there is no prompt character).

To run cross-target command-line tests as quickly as possible, the "-haxe X" flag concurrently runs the Haxe compiler and executes the resulting code as follows:

  • "-haxe all" - all supported targets (C++, C#, Java, JavaScript)
  • "-haxe bench" - all supported targets (C++, C#, Java, JavaScript) but using benchmark settings
  • "-haxe js" - only compiles and runs nodeJS (for automated testing, exits with an error if one occurs)
  • "-haxe jsfu" - only compiles (-D fullunsafe) and runs nodeJS (for automated testing, exits with an error if one occurs)
  • "-haxe cpp" - only compiles and runs C++ (for automated testing, exits with an error if one occurs)
  • "-haxe cs" - only compiles and runs C# (for automated testing, exits with an error if one occurs)
  • "-haxe java" - only compiles and runs Java (for automated testing, exits with an error if one occurs)
  • "-haxe math" - only runs C++ and JS with the -D fullunsafe haxe flag (using JS dataview)
  • "-haxe interp" - only runs the haxe interpreter (for automated testing, exits with an error if one occurs)

Compiler output is suppressed and results appear in the order they complete, with an execution time, for example:

tardisgo -haxe all myprogram.go

When using the -haxe flag with the -test flag, if the file "tgotestfs.zip" exists in the current directory, it will be added as a haxe resource and its contents auto-loaded into the in-memory file system.

If you can't work-out what is going on prior to a panic, you can add the "-trace" tardisgo compilation flag to instrument the code even further, printing out every part of the code visited. But be warned, the output can be huge.

Please note that strings in Go are held as Haxe strings, but encoded as UTF-8 even when strings for that host are encoded as UTF-16. The system should automatically do the translation to/from the correct format at the Go/Haxe boundary, but there are certain to be some occasions when a translation has to be done explicitly (see Force.toHaxeString/Force.fromHaxeString in haxe/haxeruntime.go).

Benchmarks

Tabulating the very simple indicative benchmarking results, looking only at elapsed (rather than cpu) time in seconds, as a multiple of the Go time:

Test - of what functionality C++ C# Java JS Closure/JS GopherJS
mandel.go - floating point 1.07x 2.73x 1.25x 1.24x 1.11x 0.99x
fannkuch.go - slice & array indexing 2.09x 4.22x 3.35x 5.31x 5.23x 3.54x
binarytree.go - garbage collection 16.92x 11.62x 1.61x 8.56x 6.58x 0.32x (!)

Figures above are the latest results as at 2nd July 2015, including performace figures after running the Google Closure Compiler on the JS and from the parallel project GopherJS (un-minified). The Haxe compilation flag "-D inlinepointers" was used for all targets, the additional flag "-D useloacalfunctions" was used for the JS target.

Execution speed significantly improved after:

  • re-writing code generation for non-goroutine functions to reconstruct Haxe "while" and "if" control structures from the SSA form where possible; and
  • optimising away local pointers that are only used in a local sub-block and creating temporary local variables to speed execution and reduce code size; however
  • since garbage collection currently relies on the target language runtime, the same Haxe code produces very different results.

Expect further gradual speed improvements.

Unsupported Haxe targets: ActionScript, PHP, Python and Neko

The nature of ActionScript/Flash means that it is not possible to run automated tests, although it seems to be a reliable target.

The PHP, Python and Neko targets are not currently reliable enough to permit automated testing.

PHP specific issues:

  • to compile for PHP you currently need to add the haxe compilation option "--php-prefix tgo" to avoid name conflicts
  • very long PHP class/file names may cause name resolution problems on some platforms

Next steps:

Please go to http://github.com/tardisgo/tardisgo-samples for example Go code modified to work with tardisgo. Including some very simple example code.

For a small technical FAQ, please see the Wiki page.

For public help or discussion please go to the Google Group; or feel free to e-mail Elliott direct to discuss any issues if you prefer.

The documentation is sparse at present, if there is some aspect of the system that you want to know more about, please let Elliott know and he will prioritise that area to add to the wiki.

If you transpile your own code using TARDIS Go, please report the bugs that you find here, so that they can be fixed.

Why do it at all?

The internal objective of the project was for Elliott to learn Go and understand the Go runtime. For both the Go language as a whole, and for the parts of the runtime implemented in TARDISgo, this objective been achieved. However some of the early code that was written would benefit from being refactored.

The external objective of this project was to enable the same Go code to be re-deployed in as many different execution environments as possible, thus saving development time and effort.

However the advent of Go 1.5, with support for both iOS and Android, together with the excellent GopherJS project, mean that the cross-platform UI objectives of this project are now largely redundant.

But it does work. The example code demonstrates both simple command-line examples and multi-platform client-side applications in Go using the APIs available in the Haxe ecosystem:

  • The standard Haxe APIs for JavaScript and Flash.
  • OpenFL "Open Flash" to target HTML5, Windows, Mac, Linux, iOS, Android, BlackBerry, Firefox OS, Tizen and Flash, using compiled auto-generated C++ code where possible (star users are TiVo and Prezzi).

Target long-term use-cases (if the generated code and runtime environment were developed further to make them more efficient) would be:

  • For the Haxe community: provide access to the portable elements of Go's extensive libraries and open-source code base.
  • For the Go community: write code in Go and call to-and-from existing Haxe, JavaScript, Java or C# applications (in C++ you would probably just link as normal through CGo).

Future plans:

The project is currently on ice, pending inspiration for developing it further. As at August 2015, it is the only way to target the JVM or CLR from Go.

The Author retains an interest in collaborating in the development of related project ideas, like:

  • cross-platform development for Go;
  • generating code from Go's SSA form; or
  • making Go a target for Haxe.

If you would like to discuss this or any of the above project ideas, that would be wonderful, please contact Elliott.

License:

MIT license, please see the license file.

Comments
  • Division of uint64 incorrect when top bit is set

    Division of uint64 incorrect when top bit is set

    When the top bit is set in a uint/uint32/uint64 (meaning it would be negative if signed) the division operation works incorrectly for these types.

    Also need to review the modulus operation, to check it works correctly for this case.

    Example failing code in standard library strconv/atoi.go line 44 in function cutoff64.

  • fix for go1.6 (?) + errors using tardisgo

    fix for go1.6 (?) + errors using tardisgo

    I wanted to test TardisGO, with a fresh install of go 1.6 (from the official Ubuntu 64 PPA) and stumbled upon an issue at compilation with this line, which I somehow fixed. I'm really no expert in Go, so maybe there's a better way.

    This is probably not the right place to ask an unrelated question, but still... I've been trying to transpile google safebrowsing using Tardis Go:

    tardisgo -trace cmd/sblookup/main.go
    

    (I'm aware it's probably a pretty big project to start with, but ...) I get a bunch of errors such as :

    Error : *ssa.Call @ /home/clemos/go/src/github.com/tardisgo/tardisgo/goroot/haxe/go1.4/src/crypto/tls/handshake_client.go:37:20 (Haxe) invalid syntax : "tls: either ServerName or InsecureSkipVerify must be specified in th... 
    Error : *ssa.Call @ /home/clemos/go/src/github.com/tardisgo/tardisgo/goroot/haxe/go1.4/src/crypto/tls/handshake_client.go:434:21 (Haxe) invalid syntax : "tls: client certificate private key of type %T does not implement cr... 
    Error : *ssa.Call @ /home/clemos/go/src/github.com/tardisgo/tardisgo/goroot/haxe/go1.4/src/crypto/tls/handshake_client.go:274:20 (Haxe) invalid syntax : "tls: server's certificate contains an unsupported type of public key... 
    Error : *ssa.Call @ /home/clemos/go/src/github.com/tardisgo/tardisgo/goroot/haxe/go1.4/src/crypto/tls/handshake_server.go:631:26 (Haxe) invalid syntax : "tls: client's certificate's extended key usage doesn't permit it to ... 
    Error : *ssa.Call @ /home/clemos/go/src/github.com/tardisgo/tardisgo/goroot/haxe/go1.4/src/crypto/tls/handshake_server.go:644:26 (Haxe) invalid syntax : "tls: client's certificate contains an unsupported public key of type... 
    Error : *ssa.BinOp @ /home/clemos/go/src/github.com/tardisgo/tardisgo/goroot/haxe/go1.4/src/encoding/gob/decode.go:1021:63 (Haxe) invalid syntax : " can only be decoded from remote interface type; received concrete t... 
    

    I really don't know where to start debugging these errors. Can you give me a hint ?

  • README: Simplify installation, change go get command to avoid getting an error.

    README: Simplify installation, change go get command to avoid getting an error.

    Use import path pattern that I think captures the intent, but uses valid go get syntax that doesn't result in an error.

    An import path is a pattern if it includes one or more "..." wildcards. Read more about them at https://golang.org/cmd/go/#hdr-Description_of_package_lists.

  • Version?

    Version?

    Hi,

    Tardisgo is now available as an unofficial Arch Linux package: https://aur.archlinux.org/packages/tardisgo/

    But, which version number should I use? Is it version 0.1? I searched through the files and documentation, but could not find it.

    Best regards, Alexander F Rødseth

  • Question: Is there any plan to support other standard library?

    Question: Is there any plan to support other standard library?

    Now TardisGo supports a limited set of standard library. I was wondering if you have a plan to support the rest. Ideally, it would be wonderful if most existing Go programs worked with TardisGo on the web browsers without fixing.

  • `go get golang.org/x/tools` is not needed?

    `go get golang.org/x/tools` is not needed?

    Hi,

    Here's what happens when I try to install tardisgo:

    ~% go get golang.org/x/tools
    package golang.org/x/tools
        imports golang.org/x/tools
        imports golang.org/x/tools: no buildable Go source files in /home/alexander/go/src/golang.org/x/tools
    1~% echo $GOPATH
    /home/alexander/go
    ~% rm -rf ~/go/src/golang.org
    ~% go get golang.org/x/tools 
    package golang.org/x/tools
        imports golang.org/x/tools
        imports golang.org/x/tools: no buildable Go source files in /home/alexander/go/src/golang.org/x/tools
    1~% go get -u github.com/tardisgo/tardisgo
    ~% 
    

    (1~% is my prompt and means that errorcode 1 was returned, while ~% means that errorcode 0 was returned).

    This is on 64-bit Arch Linux with go 1.4.1.

    These files are present in /usr/lib/go/pkg/tool/linux_amd64/:

    5a 5c 5g 5l 6a 6c 6g 6l 8a 8c 8g 8l addr2line api cgo cover dist fix nm objdump pack pprof vet yacc

    Does this mean that go get golang.org/x/tools is not needed when installing tardisgo on Arch Linux?

    Best regards, Alexander F Rødseth

  • tardisgo-samples/wip/numberparsing: self-assignment statements & tests failing

    tardisgo-samples/wip/numberparsing: self-assignment statements & tests failing

    C++ reporting self-assignment statements, for example in gobyexample/numberparsing, which will be slowing execution down. The issue is probably present but unreported for other targets.

  • go time package does not work

    go time package does not work

    package main
    
    import (
        "time"
    )
    
    func main() {
        time.Sleep(1 * time.Second)
        println("Hello World!")
    }
    

    Error trace from tardisgo main.go && haxe -main tardis.Go --interp

    tardis/Go.hx:1544: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:1701: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:1897: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:3531: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:3869: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:4783: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:4902: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:5156: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:6216: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:6459: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:6549: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:6766: characters 5-27 : Unknown identifier : Go_time_stopTimer
    tardis/Go.hx:6775: characters 0-23 : Unknown identifier : Go_time_startTimer
    tardis/Go.hx:7095: characters 5-29 : Unknown identifier : Go_syscall_Syscall6
    tardis/Go.hx:7213: characters 5-29 : Unknown identifier : Go_syscall_Syscall6
    tardis/Go.hx:9433: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:9668: characters 0-23 : Unknown identifier : Go_time_startTimer
    tardis/Go.hx:9919: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:10028: characters 0-23 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:10360: characters 5-29 : Unknown identifier : Go_syscall_Syscall6
    tardis/Go.hx:10472: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:10559: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:10930: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:15584: characters 5-41 : Unknown identifier : Go_atomic_CompareAndSwapUintptr
    tardis/Go.hx:15760: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:15863: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:16020: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:16329: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:16442: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:16682: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:16851: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:17453: characters 5-21 : Unknown identifier : Go_time_now
    tardis/Go.hx:17946: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:18151: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:19155: characters 5-28 : Unknown identifier : Go_atomic_AddInt32
    tardis/Go.hx:19195: characters 5-39 : Unknown identifier : Go_atomic_CompareAndSwapInt32
    tardis/Go.hx:19212: characters 0-31 : Unknown identifier : Go_sync_runtime_Semrelease
    tardis/Go.hx:19353: characters 5-29 : Unknown identifier : Go_syscall_Syscall6
    tardis/Go.hx:19471: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:19711: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:20021: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:20270: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:20403: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:21340: characters 0-22 : Unknown identifier : Go_time_stopTimer
    tardis/Go.hx:21452: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:22034: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:22131: characters 5-39 : Unknown identifier : Go_atomic_CompareAndSwapInt32
    tardis/Go.hx:22176: characters 5-39 : Unknown identifier : Go_atomic_CompareAndSwapInt32
    tardis/Go.hx:22199: characters 0-31 : Unknown identifier : Go_sync_runtime_Semacquire
    tardis/Go.hx:22491: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:22587: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:23885: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:24342: characters 5-29 : Unknown identifier : Go_syscall_Syscall6
    tardis/Go.hx:26086: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:27604: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:28858: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:28961: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:29688: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:29824: characters 0-23 : Unknown identifier : Go_time_startTimer
    tardis/Go.hx:30079: characters 5-30 : Unknown identifier : Go_atomic_LoadUint32
    tardis/Go.hx:30109: characters 5-40 : Unknown identifier : Go_atomic_CompareAndSwapUint32
    tardis/Go.hx:30122: characters 0-35 : Unknown identifier : Go_sync_runtime_Syncsemrelease
    tardis/Go.hx:30218: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:30298: characters 5-32 : Unknown identifier : Go_runtime_cstringToGo
    tardis/Go.hx:30540: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:30683: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:31063: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:31199: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:31995: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:32484: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:32567: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:32677: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:32863: characters 5-28 : Unknown identifier : Go_atomic_AddInt32
    tardis/Go.hx:32909: characters 5-29 : Unknown identifier : Go_atomic_LoadInt32
    tardis/Go.hx:32922: characters 0-31 : Unknown identifier : Go_sync_runtime_Semrelease
    tardis/Go.hx:33232: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:33323: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:33411: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:36795: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:36885: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:36970: characters 5-28 : Unknown identifier : Go_atomic_AddInt32
    tardis/Go.hx:36983: characters 5-28 : Unknown identifier : Go_atomic_AddInt32
    tardis/Go.hx:37002: characters 0-31 : Unknown identifier : Go_sync_runtime_Semrelease
    tardis/Go.hx:37191: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:37279: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:37368: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:37563: characters 5-21 : Unknown identifier : Go_time_now
    tardis/Go.hx:38606: characters 5-30 : Unknown identifier : Go_atomic_LoadUint32
    tardis/Go.hx:38655: characters 0-26 : Unknown identifier : Go_atomic_StoreUint32
    tardis/Go.hx:38982: characters 5-29 : Unknown identifier : Go_syscall_Syscall6
    tardis/Go.hx:39130: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:39227: characters 5-29 : Unknown identifier : Go_syscall_Syscall6
    tardis/Go.hx:39669: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:39758: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:40029: characters 5-30 : Unknown identifier : Go_runtime_getgoroot
    tardis/Go.hx:40095: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:40160: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:40279: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:40402: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:40587: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:40667: characters 5-27 : Unknown identifier : Go_time_stopTimer
    tardis/Go.hx:41208: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:41736: characters 0-18 : Unknown identifier : Go_time_Sleep
    tardis/Go.hx:41809: characters 5-29 : Unknown identifier : Go_atomic_LoadInt32
    tardis/Go.hx:41837: characters 5-28 : Unknown identifier : Go_atomic_AddInt32
    tardis/Go.hx:41846: characters 5-29 : Unknown identifier : Go_atomic_LoadInt32
    tardis/Go.hx:41859: characters 0-23 : Unknown identifier : Go_atomic_AddInt32
    tardis/Go.hx:41897: characters 0-31 : Unknown identifier : Go_sync_runtime_Semacquire
    tardis/Go.hx:42268: characters 5-29 : Unknown identifier : Go_syscall_Syscall6
    tardis/Go.hx:42807: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:43027: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:43686: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:44107: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:44362: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:44533: characters 5-32 : Unknown identifier : Go_syscall_RawSyscall6
    tardis/Go.hx:45368: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:45456: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:45555: characters 5-29 : Unknown identifier : Go_syscall_Syscall6
    tardis/Go.hx:45646: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:46711: characters 5-29 : Unknown identifier : Go_syscall_Syscall6
    tardis/Go.hx:47063: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:47644: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:48401: characters 5-32 : Unknown identifier : Go_runtime_funcline_go
    tardis/Go.hx:48560: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:48627: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:48735: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:49502: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:50823: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:51145: characters 0-24 : Unknown identifier : Go_atomic_AddUint32
    tardis/Go.hx:51160: characters 0-35 : Unknown identifier : Go_sync_runtime_Syncsemacquire
    tardis/Go.hx:51848: characters 0-23 : Unknown identifier : Go_time_startTimer
    tardis/Go.hx:51987: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:52256: characters 5-28 : Unknown identifier : Go_atomic_AddInt32
    tardis/Go.hx:52269: characters 0-31 : Unknown identifier : Go_sync_runtime_Semacquire
    tardis/Go.hx:52287: characters 5-28 : Unknown identifier : Go_atomic_AddInt32
    tardis/Go.hx:52610: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:54692: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:54886: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:55782: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:55896: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:55971: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:57221: characters 6-22 : Unknown identifier : Go_time_now
    tardis/Go.hx:57810: characters 5-33 : Unknown identifier : Go_runtime_funcentry_go
    tardis/Go.hx:59181: characters 5-29 : Unknown identifier : Go_syscall_Syscall6
    tardis/Go.hx:60947: characters 5-29 : Unknown identifier : Go_syscall_Syscall6
    tardis/Go.hx:61031: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:61613: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:61754: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:62023: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:62209: characters 5-29 : Unknown identifier : Go_syscall_Syscall6
    tardis/Go.hx:63208: characters 0-33 : Unknown identifier : Go_sync_runtime_Syncsemcheck
    tardis/Go.hx:63752: characters 0-34 : Unknown identifier : Go_syscall_runtime_BeforeFork
    tardis/Go.hx:63759: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:63781: characters 0-33 : Unknown identifier : Go_syscall_runtime_AfterFork
    tardis/Go.hx:63815: characters 0-33 : Unknown identifier : Go_syscall_runtime_AfterFork
    tardis/Go.hx:63835: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:63854: characters 0-26 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:63865: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:63881: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:63898: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:63931: characters 6-32 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:63944: characters 6-32 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:63957: characters 6-32 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:63970: characters 6-32 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:63987: characters 6-32 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:64008: characters 0-26 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:64036: characters 6-32 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:64059: characters 0-26 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:64093: characters 0-26 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:64109: characters 6-32 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:64122: characters 6-32 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:64135: characters 0-26 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:64156: characters 6-32 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:64172: characters 6-32 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:64185: characters 6-32 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:64197: characters 0-26 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:64880: characters 5-29 : Unknown identifier : Go_syscall_Syscall6
    tardis/Go.hx:65106: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:65203: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:66092: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:66181: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:66566: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:67229: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:67744: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:68630: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:68748: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:68841: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:69231: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:69547: characters 5-32 : Unknown identifier : Go_runtime_funcname_go
    tardis/Go.hx:69789: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:69876: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:69985: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:70122: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:70661: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:70748: characters 5-28 : Unknown identifier : Go_atomic_AddInt32
    tardis/Go.hx:70761: characters 0-31 : Unknown identifier : Go_sync_runtime_Semacquire
    tardis/Go.hx:71449: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:71597: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:71908: characters 5-31 : Unknown identifier : Go_syscall_RawSyscall
    tardis/Go.hx:72335: characters 5-28 : Unknown identifier : Go_syscall_Syscall
    tardis/Go.hx:72519: characters 5-28 : Unknown identifier : Go_atomic_AddInt32
    tardis/Go.hx:72532: characters 0-31 : Unknown identifier : Go_sync_runtime_Semrelease
    tardis/Go.hx:72944: characters 0-24 : Unknown identifier : Go_syscall_setenv_c
    tardis/Go.hx:73194: characters 5-29 : Unknown identifier : Go_syscall_Syscall6
    
  • Optimize u/int64 for C++, Java and C#

    Optimize u/int64 for C++, Java and C#

    Java and C# hosts have native int64 types, but these are not currently being utilised (although they were, but caused problems when processing unsigned values). The code in the Haxe runtime that did this is currently commented out.

  • Testing of string package required, known issues

    Testing of string package required, known issues

    tardisgo-samples/gobyexample/stringfuncs string.Split() for Flash: Correct result should be:

    stringfuncs.go:30,Split:     ,Interface{Slice{0,5,[a,b,c,d,e]}:[]string}
    

    Flash result is:

    stringfuncs.go:30,Split:     ,Interface{Slice{0,0,[]}:[]string}
    
  • Review handling of int and uint in JS

    Review handling of int and uint in JS

    In discussion with Richard Musiol who wrote GopherJS, he said that the code ran faster when he used >>0 or >>>0 to always cast int/uint, investigate how to do the same.

  • tardisgo.go:302:15: prog.CreateTestMainPackage undefined (type *ssa.Program has no field or method CreateTestMainPackage)

    tardisgo.go:302:15: prog.CreateTestMainPackage undefined (type *ssa.Program has no field or method CreateTestMainPackage)

    I'm trying to run iso on Windows with go1.13.9, and I'm getting this error, what's the correct version of go to run this, I've tried go1.10.8 and go1.7.6 and I also have problems

    PS C:\MyGoProjects\src\github.com\theodus\go-transpiler> go get -u github.com/tardisgo/tardisgo
    # golang.org/x/sys/execabs
    ..\..\..\golang.org\x\sys\execabs\execabs.go:31: syntax error: unexpected = in type declaration
    ..\..\..\golang.org\x\sys\execabs\execabs.go:35: syntax error: unexpected = in type declaration
    ..\..\..\golang.org\x\sys\execabs\execabs.go:39: syntax error: unexpected = in type declaration
    # golang.org/x/tools/internal/typeparams
    ..\..\..\golang.org\x\tools\internal\typeparams\normalize.go:164: u.EmbeddedType undefined (type *types.Interface has no field or method EmbeddedType)
    PS C:\MyGoProjects\src\github.com\theodus\go-transpiler> go version
    go version go1.7.6 windows/amd64
    PS C:\MyGoProjects\src\github.com\theodus\go-transpiler> go version
    go version go1.10.8 windows/amd64
    PS C:\MyGoProjects\src\github.com\theodus\go-transpiler> go get -u github.com/tardisgo/tardisgo
    # golang.org/x/tools/internal/typeparams
    ..\..\..\golang.org\x\tools\internal\typeparams\normalize.go:164:17: u.EmbeddedType undefined (type *types.Interface has no field or method EmbeddedType)
    PS C:\MyGoProjects\src\github.com\theodus\go-transpiler> go version
    go version go1.13.9 windows/amd64
    PS C:\MyGoProjects\src\github.com\theodus\go-transpiler> go get -u github.com/tardisgo/tardisgo
    # github.com/tardisgo/tardisgo
    ..\..\tardisgo\tardisgo\tardisgo.go:302:15: prog.CreateTestMainPackage undefined (type *ssa.Program has no field or method CreateTestMainPackage)
    PS C:\MyGoProjects\src\github.com\theodus\go-transpiler>
    
  • [Question] tardisgo as haxe library contribution tool.

    [Question] tardisgo as haxe library contribution tool.

    Hello there!

    I'm a new haxe user and not a golang user at all. But I see serious potential in this project form a point of view that perhaps you have missed.

    As you might already know, haxe is a unique technology to maintain libraries since they can be easily exported to different languages such as cpp, java, js (node.js and browser), python, etc.

    A "problem" I see in the haxe ecosystem, as a new user, is the lack of libraries written in haxe, even the basic ones, such as encoder/decoders for basic formats such as zip, jpeg and many others.

    If those were available as haxe projects, it would not only enhance the haxe developers experience (that now they need to manually integrate native third party libraries to their projects/ targets) but most important, they it would be very easy to export a libraries haxe target languages.

    I see this project is able to generate haxe versions of go standard libraries, and among them I see some that are not currently supported by haxe standard libraries and not even in haxelib repositories.

    I wonder if you thought about this aspect and tardisgo project as a way of contribute to haxe with libraries ported from go.

    Although I have no experience with go, I'm trying now to generate the go standard libraries tests and see how haxe code looks like and if might be useful to build haxe libraries for use cases missed in haxe, starting with jpeg and zip encoder which are currently not available for all haxe target platforms.

    Maybe this aspect could help promoting this project, this time involving the haxe community not only go's.

    Thanks! and keep it up!

  • It's not really an issue - but it is  :)

    It's not really an issue - but it is :)

    I think this is great project, and main issue is that is on ice. I want to use some Go logic (game logic) in client (C#) and this is the currently only way to share same code on server (golang) and client (C#), automagically transpile Golang->Haxe->C#.

    Just hope you will remove this project out of ice box. :)

  • GOmap float values in compound keys for C#

    GOmap float values in compound keys for C#

    On the Haxe C++ & C# targets, the standard library function Std.string() rounds float values, for example both Std.string(1.9999999999999998) and Std.string(2.0000000000000004) give the result 2. The next code release will fix this issue where the map key is a float, but not where a compound value containing one or more floats (struct, array, slice, complex etc.) is the key.

  • Project files structure

    Project files structure

    Hello Elliott,

    I'm back to your project after ~ 1 month of Go learning & practice, to make tardisgo better ! :dancers:

    I'm posting this question in an issue, because it could be interesting for everyone !

    Could you explain how the files are structured deeply please ? (to find & write the right code in the right place ^^)

    Moreover, I don't understand how all this huge haxe file is generated. Where & Why those t0, t1, t... & subFn1, subFn2 etc... come frome ? So could you explain how it works globally ? (I know, that's probably a hell to write, but that's important, I guess, to understand what you have in mind ^^)

    For example, the StackFrame interface, seems to be very important, but how does it works together ? (the thing that I understand the less, is the code generate for unicode packages.., its size..)

    Thank you, Regards, Axel

Related tags
go2cpp : convert go to cpp using go ast

px_golang2cpp convert go to cpp convert map to std::unordered_map convert array to vector convert 'var test bool' to 'bool test{}' convert 'var test =

Oct 30, 2022
Java properties scanner for Go

Overview Please run git pull --tags to update the tags. See below why. properties is a Go library for reading and writing properties files. It support

Jan 7, 2023
A JavaScript interpreter in Go (golang)

otto -- import "github.com/robertkrimen/otto" Package otto is a JavaScript parser and interpreter written natively in Go. http://godoc.org/github.com/

Jan 2, 2023
A compiler from Go to JavaScript for running Go code in a browser

GopherJS - A compiler from Go to JavaScript GopherJS compiles Go code (golang.org) to pure JavaScript code. Its main purpose is to give you the opport

Dec 30, 2022
ECMAScript/JavaScript engine in pure Go

goja ECMAScript 5.1(+) implementation in Go. Goja is an implementation of ECMAScript 5.1 in pure Go with emphasis on standard compliance and performan

Jan 1, 2023
Transpiling fortran code to golang code

f4go Example of use > # Install golang > # Compile f4go > go get -u github.com/Konstantin8105/f4go > cd $GOPATH/src/github.com/Konstantin8105/f4go > g

Sep 26, 2022
A BASIC interpreter written in golang.
A BASIC interpreter written in golang.

05 PRINT "Index" 10 PRINT "GOBASIC!" 20 PRINT "Limitations" Arrays Line Numbers IF Statement DATA / READ Statements Builtin Functions Types 30 PRINT "

Dec 24, 2022
PHP bindings for the Go programming language (Golang)

PHP bindings for Go This package implements support for executing PHP scripts, exporting Go variables for use in PHP contexts, attaching Go method rec

Jan 1, 2023
High-performance PHP-to-Golang IPC bridge

High-performance PHP-to-Golang IPC bridge Goridge is high performance PHP-to-Golang codec library which works over native PHP sockets and Golang net/r

Dec 28, 2022
High-performance PHP application server, load-balancer and process manager written in Golang
High-performance PHP application server, load-balancer and process manager written in Golang

RoadRunner is an open-source (MIT licensed) high-performance PHP application server, load balancer, and process manager. It supports running as a serv

Dec 30, 2022
Expression evaluation in golang
Expression evaluation in golang

Gval Gval (Go eVALuate) provides support for evaluating arbitrary expressions, in particular Go-like expressions. Evaluate Gval can evaluate expressio

Dec 27, 2022
golang AST matcher

goastch (GO AST matCH) Introduction Inspired by ast matcher. There are four different basic categories of matchers: Node Matchers: Matchers that match

Nov 11, 2022
Scriptable interpreter written in golang
Scriptable interpreter written in golang

Anko Anko is a scriptable interpreter written in Go. (Picture licensed under CC BY-SA 3.0, photo by Ocdp) Usage Example - Embedded package main impor

Dec 23, 2022
Arbitrary expression evaluation for golang

govaluate Provides support for evaluating arbitrary C-like artithmetic/string expressions. Why can't you just write these expressions in code? Sometim

Jan 2, 2023
hotbuild - a cross platform hot compilation tool for golang
hotbuild - a cross platform hot compilation tool for golang

hotbuild A cross platform hot compilation tool By monitoring the modification of the project directory file, the recompilation and running are automat

Dec 12, 2022
The golang tool of the zig compiler automatically compiles different targets according to the GOOS GOARCH environment variable. You need to install zig.

The golang tool of the zig compiler automatically compiles different targets according to the GOOS GOARCH environment variable. You need to install zig.

Nov 18, 2022
Tgo - Test Helpers for Standard Golang Packages

Test Helpers for Standard Golang Packages see example_test.go go test --- FAIL:

Apr 26, 2022
Logexp - Logical expression compiler for golang

Logical Expression Compiler Functions: - Compile(exp string) - Match(text string

Jan 24, 2022
Runcmd - just golang binary that runs commands from url or local file and logs output

runcmd just golang binary that runs commands from url or local file and logs out

Feb 2, 2022