Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

please help me with this homework and explain how to do it image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

Why are clouds white?

Answered: 1 week ago