Clearly define the language of the grammar given in question

Clearly define the language of the grammar given in question

S -> A | BZ

A -> 0A0 | Y

B -> 0B1

Y -> Y1 | 1

Z -> 0Z | 0 7)

Solution

Given grammar is:

S -> A | BZ

A -> 0A0 | Y

B -> 0B1

Y ->Y1 | 1

Z -> 0Z | 07)

-----------------------

S -> A | BZ

S -> 0A0 | Y | 0B10Z | 0B107)

S -> 00A00 | 0Y0 | Y1 | 1 | 00B1100Z | 00B11007) | 00B1107) ----->> 1 IS ACCEPTED

S -> 000A000 | 00Y00 | 0Y10 | 010 | 000B111000Z | 000B1110007) | 000B111007) | 000B11107) ----->> 010 IS ACCEPTED

S -> 0000A0000 | 00Y100 | 00100 | 0Y110 | 0000B11110000Z | 0000B111100007) | 0000B11110007) | 0000B1111007 | 0000B111107 ----->>00100 IS ACCEPTED

NEXT ----->>01110 IS ACCEPTED AND SO ON...

The grammar sequence is 1, 010, 00100, 01110 and so on...

Therefore, the grammar is G : ( {S, A, B, Z, Y}, {0,1,7}, S, { S -> A |BZ, A -> 0A0 | Y1 | 1, B -> 0B1, Z -> 0Z | 07} )

Clearly define the language of the grammar given in question S -> A | BZ A -> 0A0 | Y B -> 0B1 Y -> Y1 | 1 Z -> 0Z | 0 7)SolutionGiven grammar is

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site