Answered step by step
Verified Expert Solution
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:
S S S S S S a aaaaaaa
S S S S a e aaaaaa
S S S S S S S S a aaaaaaa
A For each grammar fully construct the parser states LR SLR LR
and LALR and examine whether it belongs to one or more of the four classes of LRtype parser. Identify any conflicts that may occur in the states without building any parser tables.
B For those grammars that are not LR explain whether they can be LRk for any
k or not and why.
C Depending on your answer to question A construct the simplest deterministic LRtype parser matrix you can for each of the three grammars.
D For nonLR grammars, construct the LR 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 nondeterministic, 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started