0

How is a~b~c^d evaluated when both operators have same precedence and ~ and ^ are left and right associative respectively. Can somebody explain. Thanks

Veve
  • 6,643
  • 5
  • 39
  • 58
ben gates
  • 1
  • 1

1 Answers1

0

It isn't. Precedence and associativity are ways to disambiguate grammars and if you restrict your ability to use them, you're back to having ambiguous grammars. Conversely, deciding on one parse tree implies this problem does not exist. For instance, if you parse b~c^d as (b~c)^d, then either ~ has higher precedence or ^ is left associative.

robot1208
  • 191
  • 1
  • 7