+ Link For Assignments, GDBs & Online Quizzes Solution 
+ Link For Past Papers, Solved MCQs, Short Notes & More 
Question Statement: [10] Consider the following grammar: S à 1AB/ε A à 1AC/0C B à 0S C à 1 And test that weather grammar is LL (1) or not. Hint: Calculate First and Follow.
Note:

Do not put any query at MDB about this assignment, if you have any query then email at CS606@vu.edu.pk
Tags:
+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)
+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)
+ Click Here to Search (Looking For something at vustudents.ning.com?) + Click Here To Join (Our facebook study Group)sir please koi idea solution jaldi se upload kren. aj last date he. please............................
i want the idea solution of cs606 3rd assignment.......
Samajh say bahir hai ye subject aur references bhi bh=ohat difficult hain...Concepts clear hi nahi hotay....
Plzzz listen abhi 3rd Assignment hui nahi aurrrr LMS payee aap sab kay liayee assignment No 4 ka gift bhi pash kar dia gia hai.........................
Reffer the link below for refference.
www.cs.virginia.edu/~cs415/reading/FirstFollowLL.pdf
To check if a grammar is LL(1), one option is to construct the LL(1) parsing table and check for any conflicts. These conflicts can be
Let's try this on your grammar by building the FIRST and FOLLOW sets for each of the nonterminals. Here, we get that
FIRST(X) = {a, b, z}
FIRST(Y) = {b, epsilon}
FIRST(Z) = {epsilon}
We also have that the FOLLOW sets are
FOLLOW(X) = {$}
FOLLOW(Y) = {z}
FOLLOW(Z) = {z}
From this, we can build the following LL(1) parsing table:
a b z $
X a Yz Yz
Y bZ eps
Z eps
Since we can build this parsing table with no conflicts, the grammar is LL(1).
To check if a grammar is LR(0) or SLR(1), we begin by building up all of the LR(0) configurating sets for the grammar. In this case, assuming that X is your start symbol, we get the following:
(1)
X' > .X
X > .Yz
X > .a
Y > .
Y > .bZ
(2)
X' > X.
(3)
X > Y.z
(4)
X > Yz.
(5)
X > a.
(6)
Y > b.Z
Z > .
(7)
Y > bZ.
From this, we can see that the grammar is not LR(0) because there are shift/reduce conflicts in states (1) and (6). Specifically, because we have the reduce items Z → . and Y → ., we can't tell whether to reduce the empty string to these symbols or to shift some other symbol. More generally, no grammar with εproductions is LR(0).
However, this grammar might be SLR(1). To see this, we augment each reduction with the lookahead set for the particular nonterminals. This gives back this set of SLR(1) configurating sets:
(1)
X' > .X
X > .Yz [$]
X > .a [$]
Y > . [z]
Y > .bZ [z]
(2)
X' > X.
(3)
X > Y.z [$]
(4)
X > Yz. [$]
(5)
X > a. [$]
(6)
Y > b.Z [z]
Z > . [z]
(7)
Y > bZ. [z]
Now, we don't have any more shiftreduce conflicts. The conflict in state (1) has been eliminated because we only reduce when the lookahead is z, which doesn't conflict with any of the other items. Similarly, the conflict in (6) is gone for the same reason.
© 2021 Created by + M.Tariq Malik. Powered by
Promote Us  Report an Issue  Privacy Policy  Terms of Service
We are usergenerated contents site. All product, videos, pictures & others contents on site don't seem to be beneath our Copyrights & belong to their respected owners & freely available on public domains. We believe in Our Policy & do according to them. If Any content is offensive in your Copyrights then please email at m.tariqmalik@gmail.com Page with copyright detail & We will happy to remove it immediately.
Management: Admins ::: Moderators
Awards Badges List  Moderators Group
All Members  Featured Members  Top Reputation Members  Angels Members  Intellectual Members  Criteria for Selection
Become a Team Member  Safety Guidelines for New  Site FAQ & Rules  Safety Matters  Online Safety  Rules For Blog Post