I am looking at the source code of Go ast.go on here , and there are 3 types of interfaces that are expressions, statements and declarations. But only with the source code, I could not understand the difference between the two. What I can understand is that this expression leads to an object that can be assigned or matched or used as a parameter, while statements are some kind of flow control, like if-else or for loop. But I found some type definitions
IncDecStmt struct {
X Expr
TokPos token.Pos
Tok token.Token
}
shouldn't be an expression? I feel embarrassed how to distinguish between expressions and statements, are there any rules?
source
share