Question: Grammer in question #7 Please fully answer question 8 8. ( 10 points) Consider the grammar in Question #7 above (prior to your modification), and

8. ( 10 points) Consider the grammar in Question #7 above (prior to your modification), and the token string: "num + mum " (mum + num)". a. Show a leftmost derivation of the string. b. Show a rightmost derivation of the string. c. Show the parse tree (not the AST) corresponding to the leftmost derivation you gave in part (a). d. Would the parse tree corresponding to a rightmost derivation be the same as you came up with in part (c)? Why/why not? expr expr addop term term addop +1 term term mulop factor factor mulop factor ( expr ) num 8. ( 10 points) Consider the grammar in Question #7 above (prior to your modification), and the token string: "mam + mam " (mum + num)". a. Show a lefmost derivation of the string. b. Show a rightmost derivation of the string. c. Show the parse tree (not the AST) corresponding to the leftmost derivation you gave in part (a). d. Would the parse tree corresponding to a rightmost derivation be the same as you came up with in part (c)? Why/why not
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
