Calculating attributes' values in the semantic analysis stage I'm reading through the book : "Compiler Construction: Principles and Practice". In chapter 6 : semantic analysis, an example about attribute grammars is given. The example is of a simple integer arithmetic expressions (I posted a picture because different fonts means different things as you may know):



where the bold Courier font is a token and the Times New Roman is grammar.

Now this parse tree represents the expression: (34-3)*42 which is 1302. I know that every attribute rule corresponds with a grammar rule, and we're actually starting with the rule exp->term because it is what it fits the given expression, but I just don't understand how did the compiler know the value in the first place? When was the value computed? How does the compiler start implementing the semantic analysis? did it start from the bottom where the number token is? I hope I made it clear.
The computer is using the rules in the left-hand column of your table. This amounts to a bottom up approach: to compute the value of a node you first compute (recursively) the values of all its children, and then you use the given rule to compute the value of the node itself.