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

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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!