-
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?
-
- + is left associative, while * is right associative
- + is right associative, while * is left associative
- Both + and * are right associative
- Both + and * are left associative
- + is left associative, while * is right associative
Correct Option: B
+ is right associative (with right recursion from S) is left associative (with left recursion from T)