For this discussion, operations have 2 properties of interest:
- Precedence
- Associativity
Both, yes, are used to disambiguate expressions. (Note, e.g., that prefix and postfix expressions never need to rely on precedence, and never need parenthesis to force evaluation.)
Precedence applies when 2 operators are adjacent; the operator with the higher precedence is evaluated first. $2 + 3 \times 5$ is always 17. In such examples, associativity plays no role. (When I say always, I mean, in math. Every programming language I know will do it this way, but that doesn't make them authoritative. Not all calculators yield this answer, though (infix) scientific calculators should.)
When 2 operators with the same precedence are adjacent, then associativity applies. The four basic arithmetic operators associate left-to-right. So, $8 - 3 - 2$ is always 3.
There are other operations which associate right-to-left. Exponentiation. $2^{3^2}$, which might be written as 2 ^ 3 ^ 2 in some languages, is always $2^9 = 512$. We use parenthesis to force evaluation otherwise: $\left(2^3\right)^2 = 8^2 = 64$.
While we're here, for clarity, 'cause I've seen too many CS professors get this wrong, associativity does not apply when evaluating, e.g., $ 3 \times 7 + 64 \div 16$ It does not matter (in arithmetic) whether the multiplication is performed first, or the division, just so they are both performed before the addition is applied (per the precedence rules). Languages like C, Python and Java have no rules about which is evaluated first, either.
Someone commented above that math teachers should learn programming. Languages are not authoritative; it is up to them to implement the rules of math correctly (or, not). For example, while writing this, the Tex engine balked at $2^3^2$
, insisted I put braces in to clarify, though math is quite clear on the subject. OTOH, Python3 evaluates 2**3**2
just fine.
I would say it is important for programmers to be good at math, and know a bit about language theory. Side-effects are not a concern in arithmetic, but must be considered in programming.