Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following grammars and the corresponding random strings they generate: 1 . S - > + S S | * S S | +

Consider the following grammars and the corresponding random strings they generate:
1. S ->+ S S |* S S |+ S| a +a+*++a*aa+a*aa
2. S -> S ( S S )| a | e (a(a((aa)a)(a)))
3. S -> S + S * S | S * S + S |( S )| a (a+a*a)*a*a+a+(a)
A. For each grammar fully construct the parser states LR(0), SLR(1), LR(1)
and LALR(1), and examine whether it belongs to one or more of the four classes of LR-type parser. Identify any conflicts that may occur in the states without building any parser tables.
B. For those grammars that are not LR(1) explain whether they can be LR(k) for any
k>1 or not and why.
C. Depending on your answer to question A, construct the simplest deterministic LR-type parser matrix you can for each of the three grammars.
D. For non-LR(1) grammars, construct the LR(1) parser table with multiple moves at the positions where there is a conflict, and then see if preselecting one move per case can resolve the conflict, if deleting the rest of the moves results in a deterministic matrix of syntactic analyzer which can
recognize the same language as the language of the original grammar.
Q. Based on the tables you constructed in the previous questions, describe
the steps to identify the matching strings. In particular, if an array is non-deterministic, use backtracking where necessary so that by trying multiple options you can reach identification.

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

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions

Question

1. Who is your target audience? (everyone cannot be an answer here)

Answered: 1 week ago

Question

What problems have created the client's needs?

Answered: 1 week ago

Question

create simple design pieces exhibiting visual and rhetorical focus.

Answered: 1 week ago