1,282 views
2 votes
2 votes

Find a context free grammar for ∑ = {a,b} for the language 

L = { an wwR bn : w ∈ ∑*, n>=1 } 

I have worked out the following set of productions

S--> aSb | aAb //generates anbn

A--> aXa | bXb | ∈ (Generates wwR which can be considered as string starting and ending with same symbol).

X--> aX | bX | ∈

are my productions correct?

1 Answer

Best answer
4 votes
4 votes

$$\begin{align*} &A\rightarrow aAb|{\color{red}{a}}X{\color{red}{b}} \\ &{\color{blue}{X}}\rightarrow a{\color{blue}{X}}a|b{\color{blue}{X}}b|\epsilon \\ \end{align*}$$

selected by

Related questions

0 votes
0 votes
3 answers
2
Ayush Upadhyaya asked Mar 19, 2017
1,290 views
Is the following language context-free?L= { uvwvR : u,v,w∈ {a,b}+ |u| = |w| =2 }If yes, provide set of productions for the same.
1 votes
1 votes
2 answers
4
Ayush Upadhyaya asked Mar 19, 2017
2,089 views
Give a context-free grammar for the language below :(n>=0, m>=0)L= { w ∊ {a,b}* : na(w)=2nb(w)+1}