Consider a language of strings that contain only dots and da

Consider a language of strings that contain only dots and dashes. All strings in this language contain at least five characters and end with either two dots or two dashes. If the last two characters are dots, the first one must be a dash; if the last two characters are dashes, the first one must be a dot. Write a recursive grammar for this language

Solution

L= {<dot><dot><dot><dash><dash>,

<dot><dot><dash><dash><dash>,

<dash><dash><dot><dot><dot>,

<dash><dash<<dash><dot><dot>

so --..- and -..-- is not possible

Consider a language of strings that contain only dots and dashes. All strings in this language contain at least five characters and end with either two dots or

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site