killiantos
killiantos

Reputation: 1

Context Free Grammar tips

So I've come across this problem in my study of context free grammars and I have no idea how to get the production rules of this English sentence.

Language L is defined as: "All odd-length strings over {a, b}∗ with middle symbol a."

Upvotes: 0

Views: 1033

Answers (1)

Harald Gliebe
Harald Gliebe

Reputation: 7544

You can build the string from the middle and always add one letter to both sides

A -> aAa | aAb | bAa | bAb | a

Upvotes: 1

Related Questions