Question

Automata Theory Give a context-free grammar producing the following language over Σ = {0, 1}: {w...

Automata Theory

  1. Give a context-free grammar producing the following language over

Σ = {0, 1}:

{w : every odd position of w is 1 and w = wR}

(HINT: All strings in the language will be of odd length).

0 0
Add a comment Improve this question Transcribed image text
Answer #1

TO UNDERSTAND THE QUESTION :
Lets see for some of the strings which are  accepted or not, by language over

Σ = {0, 1}: {w : every odd position of w is 1 and w = wR}
(YES : Accepted )
(NO: Not accepted)

YES | w: 1 (w = wR), (1st position is odd positiion, every odd position of w is 1)
NO | w: 10 (all the strings of the language will be of odd length)
YES | w : 101 (even position can be 0 or 1)
YES | w: 111 ( even position can be 0 or 1)

and so on...

So, for all strings w in language given,

  1. ALL strings should be of odd length.
  2. ALL strings start with 1 (because starting position of any string 'w' is one which is odd position).
  3. ALL strings end with 1 (because 'w' starts with 1 and string has to be palindrome (w=wR) ).
  4. EVEN position of string can have only 1 or only 0.

=========================================

So Context Free Grammar (CFG) for such a language is ,

S --> RPR | R
P --> TST | RSR | T | R
T --> 0
R --> 1

==========================================

Where,

  • {S,P,T,R} belongs to NON TERMINALS / VARIABLES
  • {S} is Start Symbol
  • {1,0} belongs to terminals.

==========================================

Add a comment
Know the answer?
Add Answer to:
Automata Theory Give a context-free grammar producing the following language over Σ = {0, 1}: {w...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT