Consider the given grammar:
E → E + T | E - T | T
T → T * F | T / F | F
F → G ↑ F | G
G → id
What will be the value for the expression 5 + 2 / 1 – 3 – 8 * 7
(A) -53
(B) -52
(C) -51
(D) None of these.
Answer: (B)
Explanation: Parse tree for the above expression:
Expression value will be (-52).
So, option (B) is correct.
Quiz of this Question
Share your thoughts in the comments
Please Login to comment...