The go-- compiler targets a significant subset of the Go programming language. Validates Go programs and produces native executables.
You can find the first version of this compiler (this is the third) here: https://github.com/obround/go.rs.
- Rust toolchain (latest)
- Clang
- LLVM 21
- Make
- Bohem GC
Clone the repository and run make:
git clone https://github.com/obround/go--
cd go--
makeThis will create an executable bin/go--.
To compile and run a Go source file:
/bin/go-- examples/mandelbrot.go
./examples/mandelbrot.goYou can also inspect the generated LLVM IR using the --emit-llvm option.
/bin/go-- examples/rayTracer.go
./examples/rayTracer > image.ppm
bin/go-- examples/donut.go
bin/go-- examples/fluidSim.go
./examples/donut
./examples/fluidSimThe go-- compiler supports a respectable subset of Go programs with many constructs: structs, methods, slices, arrays, maps, etc.
However, it notably does not support (yet): Interfaces, packages, concurrency, multi-file code, and some syntactic sugars
flowchart LR
A[Source .go] --> C(Lexer / Parser)
C --> D[AST]
D --> E(Semantic Check / Lowering)
E --> F[Go-- IR]
F --> G(LLVM Codegen)
G --> H[Native Binary]
I am planning on rewriting the analysis phase to separate semantic checking and lowering -- this should make for significantly cleaner code. I also plan to push some of my local tests for both the semantic checking and code generation phases.
MIT

