CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

The two grammars given below generate a language over the alphabet {x,y,z}

G1:SxzxSzSyB
ByzyBzB

G2:SyzySzSxB
ByyS

Which one of the following choices describes the properties satisfied by the strings in these language ?


A
G1: No y appears before any x

G2: No x appears before any y
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
G1: No y appears after any x

G2: Every x is followed by at least one y
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
G1: No y appears after any x

G2: Every y is followed by at least one x
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
G1: No y appears before any x

G2: Every x is followed by at least one y
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
Open in App
Solution

The correct option is D G1: No y appears before any x

G2: Every x is followed by at least one y
G1:SxzxSzSyB
ByzyBzB
B(y+z)+

Substitute in S to get

SxzxSzSy(y+z)+

Now solution of S is
S(x+z)S
S(x+z)(x+z+y(y+z)+)

So, L(G1) = S = (x+z)++(x+z)y(y+z)+

G1 generates every string in which "no y appears before any x"

G2:SyzySzSxB
ByyS

Substitute B in S to get

SyzySzSxyxyS

Now solution of S is

S(y+z+xy)S
S(y+z+xy)(y+z+xy)
So L(G2) = S = (y + z +xy)+
G2 generates every string in which "every x followed by atleast one y"

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Introduction to Grammars
OTHER
Watch in App
Join BYJU'S Learning Program
CrossIcon