Avoiding confusion about precedence When mentioning operator precedence for AND / OR, I explained it wrongly. I re-explained it properly using the idea of binding: the operator "binds tightly" to the two expressions immediately on either side.

My incorrect explanation was based on me thinking of a complex expression as a tree, with AND as the root. For example, this fake expression:  

expr1 OR expr2 AND expr3


behaves as if there are parentheses around expr2 AND expr3, but the "tree view of precedence" with AND being "more" would put the parentheses around the OR expression. I didn't explain my wrong idea to the students, but it is an error that I sometimes make in my thinking - it makes sense to me!

Is there a better way of explaining precedence to avoid this ambiguity than to say "it binds tightly"?

I encountered this when teaching SQL, but the question is not really about Boolean operators or Math, it is about Precedence in general as implemented in many languages. (If I had been showing a math example I would have unconsciously followed the rules of Algebra, but Booleans are not as common in my life.) A common synonym for Precedence is "Order Of Operations", but in SQL there is not supposed to be an 'order'. This is especially so with Booleans, because they just yield T/F and so there is no sense of left-to-right or anything.
Actually, your tree explanation is fine, except that it is the low precedence operators closer to the root. In Java, the "." operator is the strongest/highest and the assignment operators are the lowest precedence. The arithmetic operators are all higher precedence (bind tighter) than the booleans, with &amp;&amp; having higher precedence than ||

A semi-official list is here: http://operator-precedence.com/java

In fact many compilers will translate an expression (the entire program, in fact) into a tree structure either explicitly or implicitly. 

But, "binding tightly" is pretty traditional for an explanation also. The scope of an operator is limited by the end of the expression or the occurrence of a lower precedence operator. Therefore the RHS of the OR in your example is the end of the expression, but the LHS of the AND is bounded by the OR operator. 

In the tree explanation work from lower to higher. In the "binding tightly" work from the higher to the lower precedence operator. 



Odd historical note: To a logician, AND is logical "multiplication" and OR is logical "addition", hence the typical relationship in programming languages. 

However, Pascal took that idea a bit too far and OR had the same precedence as addition with AND having the same precedence as multiplication, requiring parentheses in many more expressions than you would like. 

On the other hand, having to write things explicitly in a programming language is usually a good thing as it lessens the likelihood of an oversight error.