a - b - c 5 - 2 - 6 - 7 use G2: right recursion means right associativity a - b - c - a - c == a - (b - (c - (a - c))) - / \ a - / \ b - / \ c - / \ a c use G3: left recursion means left associativity a - b - c - a - c == (((a - b) - c) - a) - c - / \ - c / \ - a / \ - c / \ a b Mix associativity with precedence. 4 + 5 * 6 + 4 + 5 * 7 * 8 ((4 + (5 * 6)) + 4) + ((5 * 7) * 8) use G5: Only does precedence (leaves associativity ambiguous). a + b * c + / \ a * / \ b c a * b + c + / \ * c / \ a b a + b + c * d a + b * c * d G5': Three levels of precedence, +, *, **. 2 ** 3 // operator Math.pow(2, 3) // library function 4 + 5 // operator add(4, 5) // library function (some languages do addition this way) 2 ^ 3 ^ 4 // How should the exponentiation operator associate? (2 ^ 3) ^ 4 // There is no general agreement on which is right. 2 ^ (3 ^ 4) Math.pow(Math.pow(2, 3), 4) // the library function removes the ambiguity Math.pow(2, Math.pow(3, 4))