Question: please help me with this homework problem, and please explain how to do it 1. Context free grammars, LL and LR parsing Consider the following

please help me with this homework problem, and please explain how to do itplease help me with this homework problem, and please explain how to

1. Context free grammars, LL and LR parsing Consider the following simple context free grammars Grammar Gi Grammar G2 A Abb The start symbols are G, the nonterminals are G and A, and the terminal symbols are b and $ (end of file). Note that these grammars generate the same language: strings consisting of even numbers of b symbols (including zero of them) (a) Attempt to show a shift-reduce parse of the input string bbbb for a parser for grammar G1. Show the contents of the stack, the input, and the actions (in the style of Figure 3.18 on Page 58 but without the subscripts for the parse states) Indicate any conflicts and describe why they are conflicts. Is G1 LR(1)? Is it LR(O)? (b) Attempt to show a shift-reduce parse of the input string bbbb for a parser for grammar G2. Show the contents of the stack, the input, and the actions (in the style of Figure 3.18 on Page 58 but without the subscripts for the parse states) Indicate any conflicts and describe why they are conflicts. Is G2 LR(1)? Is t LR(0)? (c) Indicate whether Gi and G2 are LL(1). You don't need to construct their LL(1) parse tables, but you may argue from other properties. (d) Of the language classes we have discussed in class, what is the smallest category into which L (G) fits? Justify your answer. [Hint: This is a trick

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!