I was reviewing some documents on the graalvm and its truffle languages and it occured to me that one could write a go ast to LLVM IR emitter. Go has pretty good support for ast operations, thus it looked feasable at least. Obviously next thing I did was to check and see if someone had already done this. And yes.There is a project doing exactly that.
The support for the language is not all there yet and honestly I don't think this is the most sustainable approach but it was fun to play with it. I got some minimal go(tre) code running through graal's lli pretty fast
- Install GraalVM, and then set your PATH so that you get the GraalVM binaries
- llvm (brew install llvm)
- go install github.com/zegl/tre/cmd/tre