Hi,

I'm trying to read golang compiler source code and now have come to the 
middle of syntax analysis: just finished parser.fileOrNil 
<https://github.com/golang/go/blob/dev.boringcrypto.go1.15/src/cmd/compile/internal/syntax/parser.go#L375>,
 
next step is noder.node() 
<https://github.com/golang/go/blob/dev.boringcrypto.go1.15/src/cmd/compile/internal/gc/noder.go#L237>
.  

So far everything is fine,  both lex and syntax tree 
<https://github.com/golang/go/blob/dev.boringcrypto.go1.15/src/cmd/compile/internal/syntax/nodes.go#L36>
 parsing 
is easy to understand. But after that part, it feels more and more 
difficult, in order to make my learning process smoother, I think I need to 
ask some help/tips from the community.

Currently I'm doing it this way:
1. Figure out the main phases and the role of each one.  
2. For each phase, figure out related data structures firstly, like 
interfaces and structs
3. Read the source code of the phase, figure out the main logic
3. Guess, and use UT to verify
4. Use git log to see the author's original thoughts

Problems I'm facing: 
1. Can't find enough docs, especially official design docs
2. Comment is not enough in code repo, I believe it's enough for compiler 
developers, but not for beginners like me

This makes it very difficult to understand the design thoughts, in some 
cases you have to read the source code line by line for its purpose, but 
still don't know why it's implemented like that in the end.

So my questions are:
1. Is there a place I can find the design docs for go compiler design?
2. What's the most productive way to learn the source code? Especially from 
the perspective of go compiler developers. 

Thanks for any helps/suggestions/tips :)

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/0ef2340e-15b6-4ed2-81d2-03ddfed3f302n%40googlegroups.com.

Reply via email to