github.com/kidsbmilk/gofronted_all@v0.0.0-20220701224323-6479d5976c5d/go/README (about) 1 See ../README. 2 3 The frontend is written in C++. It can only be used in conjunction 4 with a full compiler backend. Currently the backend interface has 5 been implemented with GCC (known as gccgo) and with LLVM (known as 6 GoLLVM). 7 8 The frontend lexes and parses the input into an IR specific to this 9 frontend known as gogo. It then runs a series of passes over the 10 code. 11 12 Finally it converts gogo to the backend IR. This is done via the 13 interface described in backend.h. The backend must implement that 14 interface. When used with GCC, the interface is implemented in 15 gcc/go/go-gcc.cc. 16 17 Source locations are represented using the interface described in 18 go-linemap.h. The backend is expected to provide a header file 19 go-location.h that defines a Location type. 20 21 The frontend does not start by itself. It expects something to call 22 go_create_gogo passing in a Backend and a Linemap, as well as other 23 options. Then it expects something to call go_parse_input_files 24 passing in the input files. Finally, a call to go_write_globals will 25 cause all global definitions to be written out via the Backend 26 interface. 27 28 The backend is expected to provide the functions defined at the 29 bottom of go-diagnostics.h: go_be_error_at, etc. These will be used 30 for error messages. 31 32 This compiler works, but the code is a work in progress. The frontend 33 pays little attention to its memory usage and rarely frees any memory. 34 The code could use a general cleanup which we have not had time to do. 35 36 Contributing 37 ============= 38 39 To contribute patches to the files in this directory, please see 40 https://golang.org/doc/gccgo_contribute.html . 41 42 The master copy of these files is hosted at 43 https://go.googlesource.com/gofrontend . There is a mirror at 44 https://github.com/golang/gofrontend . Changes to these files require 45 signing a Google contributor license agreement. If you are the 46 copyright holder, you will need to agree to the individual contributor 47 https://cla.developers.google.com/about/google-individual . This 48 agreement can be completed online. 49 50 If your organization is the copyright holder, the organization will 51 need to agree to the corporate contributor license agreement at 52 https://cla.developers.google.com/about/google-corporate . 53 54 If the copyright holder for your code has already completed the 55 agreement in connection with another Google open source project, it 56 does not need to be completed again.