-1

create a grammer for {a^nb^m, n>0, m=2^n+1}

itS unrestricted grammer. I tried to but couldnt understand. if you know the answer please breif it. coz i m new in this subject

1 Answers1

0

Hint 1. try build some automaton (Turing machine, etc.) that accept strings of given pattern, then encode both states and transitions in the grammar.

Hint 2. try some scanning process to generate $\{b^m|m=2^n+1\}$, then generate $\{a^n\}$ USING THE SAME TECHNIQUE, and try to merge them.

Some examples:

  1. Start from n=0, the sequence is bb,abbb,aabbbbb,aaabbbbbbbbb,... noticing the changes from adjacent items.
  2. Using a state variable to scan from left to right and processing, then back. $$Acc \to aAcc \to abbAc \to abbbbA \to \underline{abbbB} \to Aaccc$$ $$Aaccc\to aaAccc \to aabbAcc \to aabbbbAc \to aabbbbbbA \to \underline{aabbbbbB} \to Aaaccccc$$
  3. To make up for the direction change, and extra processing at both ends, using delimiters $\#$. Now start symbol $S\to\#Acc\#$
  4. Get rid of the state variable and delimiters at the end. But only get rid of them on accepted state.
Terence Hang
  • 789
  • 4
  • 7