Go as a backend for my compiler?

backend, code-generation, compiler-construction, go

Solution

- I'm not aware of any language project using Go as a back-end.

- Go is not designed to be a compiler back-end and or an IR.

- Go is low level enough (bit like C except for e.g. the GC) to IMO be usable as a back-end for some languages/class of languages with semantics similar/comparable/close to what Go offers.

- Would love to know more about the language you're designing ;-)

Problem

I want to make a compiler for my own programming language. Popular backend choices seem to be C, Java, LLVM, JVM bytecode, .Net bytecode, gcc, assembly... Here, I am considering the possibility of Go as a backend. Go is apparently a fast language, with garbage collection, and fast compile times. It is also portable and free (BSD-style licence). All those would make Go a good choice as a target of code generation, I think, maybe even better than the other options... So I am surprised I can't find anybody doing that already. Would Go be a good choice for code generation? Can you point at existing projects doing so, or explain why there are none? Or even better, do you have experience with using the Go language as a backend? Are there any downside I am unaware of? (I'm specifically interested in Go here. Don't just point at alternative backend options, there are questions answering that already.)

Original source

Related problems