**Language =** {a^{n }b a^{n+2} | n >=0}

## CFG

S-> a S a | a X a

X -> bC

C -> aa

## Valid strings

These strings must be accepted by our Context-free Grammar.

{ abaaa, aabaaaa, aaabaaaaa,……… }

## InValid strings

These strings must be rejected by our Context-free Grammar.

{ aba, aabaa, abba,……… }

## More Examples of CFG

- Intro to Context Free Grammar with 12 Examples
- CFG of Language of all even and odd length palindromes
- Context Free Grammar CFG for language of all even length strings
- CFG for the language of all non Palindromes
- CFG for strings with unequal numbers of a and b
- CFG of odd Length strings {w | the length of w is odd}
- CFG of Language contains at least three 1’s or three a’s {w | w contains at least three 1’s}
- CFG for the language L = 0
^{n}1^{n}where n>=1 - CFG for the language L = 0
^{n}1^{2n}where n>=1 - Write a CFG for the language L = 0
^{n}1^{4n}where n>=1 - CFG for {a
^{n }b a^{n+1}| n >=0} - CFG for {a
^{n }b a^{n+2}| n >=0} - CFG for {a
^{n }b a^{n+3}| n >=0}