Q:

Operator precedence in programming language

In programming Language class, I learned operator precedence and associativity.  The under is simple Context-Free-Grammar 
<expr> -> <expr> + <term> | <term>
<term> -> <term> * <fact> | <fact>
<fact> -> (<expr>) | a

By using Context-Free-Grammar above, we can make the sentence 
a+a+(a+a)

I think, the order of operation should be done as follow : (a+a) -> a+a then plus altogether. However, on lecture, the professor said both (a+a) -> a+a and 
a+a -> (a+a) order is right. Student's are in panic. Even in the sentence below,
(a+a)+((a+a))

Both order ((a+a)) -> (a+a) then plus and (a+a) -> ((a+a)) is correct.
He just said, after making parse tree, then converted to the assembly language
so the order depends on Compiler.
I don't understand his explanation.
Is anybody can explain why there are two possible order??

A:

Evaluation order is independent of grouping. If you need to calculate X + Y (where X and Y are sub expressions), it does not matter whether you first compute temp2 = Y and then temp1 = X or the other way around. At the end temp1 + temp2 has the same value.
Sometimes it is more convenient to compute the right-hand argument first. (Maybe you already know it from a previous computation, for example.)
If the computation of X or Y has a side effect, that might need to be taken into account. Some languages insist that side effects happen left to right; others allow any order. But in no case does parenthesis grouping affect the order of computation. It only determines what is computed.

