Syntax Analysis11

0. Consider the grammar defined by the following production rules, with two operators * and +
S → T * P
T → U|T * U
P → Q + P|Q
Q → Id
U → Id
Which one of the following is TRUE?

  • Option : B
  • Explanation :
    2nd production is
    T → T * U (left recursive) so * is left associative.
    Similarly
    P → Q + P (Right recursion) so + is right associative.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *