When I have this language, what grammar would be accepted?
$$\{w|w∈\{a,b\}^∗ \space\text{and}\space w=w^R\}$$
$S→ε$
$S→aB$
$B→bA$
$B→b$
$A→aB$
This would be my answer so far or am I wrong? I'm very unsure how to interpret this language.
When I have this language, what grammar would be accepted?
$$\{w|w∈\{a,b\}^∗ \space\text{and}\space w=w^R\}$$
$S→ε$
$S→aB$
$B→bA$
$B→b$
$A→aB$
This would be my answer so far or am I wrong? I'm very unsure how to interpret this language.
The language given is the sets of strings over $a$ and $b$ that are palindromes (i.e. they are equal to the reverse of themselves).
Your grammar is not equivalent to the language because the grammar generates $S \to aB \to ab$ and $ab$ is not a palindrome.
Hint: Think about how you would generate palindromes. Your grammar should work from the center and work outwards if that makes any sense. Don't forget to consider the case of both even and odd length palindromes.