GATE Computer ScienceModerateGATE CSE · NIELIT

With ^ right-associative and higher than * which is higher than + and − (both left-associative), what is the postfix form of a − b * c ^ d ^ e + f?

  1. A. a b c d e ^ * ^ - f +
  2. B. a b c ^ d ^ e * - f +
  3. C. a b c d e ^ ^ * f + -
  4. D. a b c d e ^ ^ * - f +

Correct answer: D. a b c d e ^ ^ * - f +

Operator precedence parsing gives a b c d e ^ ^ * - f +: d ^ e is evaluated first (right associativity), then c ^ (d^e), then b *, then a −, then + f.

More Compiler Design questions

Exams that ask this topic