Compile Go to C, with a generic library contains Go core features, like goroutine,channel,GC.
That's will generate minimal binary. The farther plan is compile any Go package to C.
- Too large binary size
- Not zero cost call with C
- Builtin string/array/map no methods
- Too verbosity error handling, not like the Go2
try
error handling proposal
- goroutine
- channel
- defer
- GC
- CGO
- interface
- closure
- string/array/map with lot builtin methods
catch
statement error handling (Line 18 in 0f21338
- unused var warning, not error
- for range => for in
- type foo struct => struct foo
- unsafe.Pointer => voidptr
- uintptr => usize
- seamless C symbol use
- zero cost C call
- all variables reference
cd $GOPATH
git clone https://github.com/kitech/cygo
cd cygo/bysrc
go build -o cygo
./cygo ./tpkgs/hello
cmake .
make
more examples/tests https://github.com/kitech/cygo/tree/master/bysrc/tpkgs/
Source code structure:
- main compiler source https://github.com/kitech/cygo/tree/master/bysrc/
- goroutine/channel implemention in C https://github.com/kitech/cygo/tree/master/corona-c/
- some go stdlib implemention https://github.com/kitech/cygo/tree/master/xgo/
- defer
- closure
- select
- dynamic stack resize
- correct and more safe point for GC
- support more OS/platforms
- so much to do
- unsafe
- errors
- minigo
- tinygo
- Let's Build A Simple Interpreter https://github.com/rspivak/lsbasi
- dwarf https://github.com/gimli-rs/gimli