The concept of precedence and associativity seems straightforward.
The operator precedence is a collection of rules that reflect conventions about which procedures to perform first in order to evaluate a given mathematical expression.
The associativity of an operator is a property that determines how operators of the same precedence are grouped in the absence of parentheses.
However, from the perspective of programming language theory, I wonder if there's a formal definition for precedence and associativity. With that formal definition, for example, we could argue that if a formal grammar defines the precedence of two operators, or that if a grammar has some property, then the operators in the grammar will have some kind of precedence.
Maybe it is possible to give a formal definition in each programming language case by case, but there's no general one?