Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations - NIMCET

Previous Year Question (PYQs)



Consider the Grammar :

$S \rightarrow A$
$A \rightarrow S B S \mid id$
$B \rightarrow B, A \mid A$

If $I_0 = CLOSURE({[S' \rightarrow .A]})$, then how many items be in the set for $GOTO(I_0, S)$





Solution

Initial item

$S' \rightarrow .A$

Closure adds productions of $A$

$A \rightarrow .SBS$
$A \rightarrow .id$

Now the item containing $S$ after dot:

$A \rightarrow .SBS$

Applying GOTO on $S$ gives

$A \rightarrow S.BS$

Now closure for $B$ adds

$B \rightarrow .B,A$
$B \rightarrow .A$

Also expand $A$

$A \rightarrow .SBS$
$A \rightarrow .id$

Total items in $GOTO(I_0,S)$ = 4


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

Ask Your Question or Put Your Review.

loading...