Problem Detail: Can we define a grammar for the following language? $$L = {a^n b^n c^{n+m} | n,m>=0},. $$ I can define one for this:
$$L={a^nb^n|n,m>=0} $$
$$L={a^nb^n|n,m>=0} $$
S –> aSb | λ
or this one: $$L={b^nc^{n+m}|n,m>=0} $$
S –> Ac
A –> bSc | Sc | λ
but I can’t solve the first one, any hint?
Asked By : Amen
Answered By : d’alar’cop
This gives the language: $L = {a^n b^n c^n c^m | n,m>=0},. $
- S → a b c C | N | ε
- N → a N B c C | a b c
- c B → W B
- W B → W X
- W X → B X
- B X → B c
- b B → b b
- C → cC | ε
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/30331