Given the grammar  $s \to aSb \mid bSb \mid a \mid b$;  what is the language generated by the grammar over the alphabet $\{a,b\}$?When I was solving this question I was a bit confused about  the language generated by this grammar. Would be set of all palindromes?Or would the language generated by the above grammar be that of all odd length palindromes?Is it possible that a palindrome generated by above grammar be of odd length only as there is no rule for $S \to \varepsilon$?
What is the language generated by a given grammar
formal languages;context free;formal grammars
The language of this grammar is all strings of the form $wb^n$  where $w\in \{a,b\}^*$, and $|w| = n+1$. If I abuse the notation a bit, it is $\Sigma^{n+1}b^n$.If perchance you mean $S \rightarrow aSa \ | \ bSb \ | \ a\ | \ b$, then the language contains all palindromic strings of odd length.