Consider the following BNF grammar in which S is the start non-terminal and @, ? and # are three binary operators:

S S @ T | T
T U ? T | U
U U # V | V
V a | b | c

Which one of the following statements is true of this grammar?

# is left-associative and has higher precedence than @.
  • All three operators are left-associative and @ has higher precedence than #.
  • All three operators are right-associative and @ has lower precedence than #.
  • T is right-associative and ? has higher precedence than #.
  • ? is right-associative and has lower precedence than @.

Review the definitions for "production," "non-terminal," "operator," "associativity of operators," and "order of precedence of operators."

Review the direct connection between the associativity property of an operator and the recursive pattern in the production that defines the operator.

Review the connection between the order of precedence of operators and their groupings into separate productions.

Review the connection between the order of precedence of operators and how far down the parse tree each operator appears, that is, how many distinct non-terminals appear on the path from the start non-terminal to the operator.