4,857 views
2 votes
2 votes

Find the context-free grammar for the following language(n>=0 and m>=0) ?

L={an bm : n<=m+3}

1 Answer

Best answer
9 votes
9 votes

$$\begin{align*} &S\rightarrow aSb \; |\; A \\ &A\rightarrow \epsilon \;|\; a \;|\; aa\;|\;aaa\;|\;B \\ &B\rightarrow bB\;|\;\epsilon \\ \end{align*}$$

selected by

Related questions

0 votes
0 votes
0 answers
2
0 votes
0 votes
1 answer
3
0 votes
0 votes
1 answer
4