My apologies, I have worded the question poorly. Basically, I want to compile Go source to a bytecode format, which will be interpreted at some later step. The design is similar to Java's compilation process.
Thus far, I know I can produce an AST from go/parser, type check it using go/types, and then traverse it as necessary to emit the bytecode. However, questions were raised about whether this was the best approach. Is there a better way to accomplish this? On Thursday, May 18, 2017 at 5:10:26 PM UTC-7, Ian Lance Taylor wrote: > > On Thu, May 18, 2017 at 11:12 AM, <alexand...@gmail.com <javascript:>> > wrote: > > > > I want to develop a new target for Go and I want to know what sort of > > support Go has to facilitate this. > > > > I know I could use some functionality that's provided in in gotypes. I > can > > use Gotypes to generate AST and typecheck it, but before I went ahead > with > > making my own visitor for the AST, I wanted to know if there is some > other > > framework already established for accomplishing this sort of thing. > > > > GCC, for example, allows new targets by operating on their IR, but I > don't > > know if there is some analog for the Go compiler. > > > > I'm aware of gccgo, but I wanted to accomplish this task entirely in Go, > if > > possible. > > Do you mean that you want to generate code for a different processor? > Which processor? > > Basically you need to start by adding your processor to > cmd/internal/obj. Then cmd/asm/internal/arch, cmd/compile/internal, > and cmd/link/internal. Look at the existing processor support while > adding your new processor. > > Then you can move on to runtime (including internal/sys and > internal/atomic) and syscall and sync/atomic. > > Then you are done, except for writing assembly-optimized versions of > code in crypto and maybe a couple of other places. > > Ian > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.