in Theory of Computation
1,663 views
0 votes
0 votes
Is the following CSG for a^n b^n c^n correct?

S->aSbC|abc

Cb->bC

C->c

If not please explain why?
in Theory of Computation
1.7k views

2 Comments

What is n?
0
0
It is generating aabcbc , So wrong
1
1

1 Answer

0 votes
0 votes

Below is the grammar for L = {a^n b^n c^n | n>=1}

S → abc | aSAc

cA → Ac

bA → bb 

Let’s try deriving string w = aaabbbccc

S → aSAc                 [S → aSAc]

   → aaSAcAc           [S → aSAc]

   → aaSAAcc           [cA → Ac]

   → aaabcAAcc       [S → abc]

   → aaabAcAcc       [cA → Ac]

   → aaabAAccc       [cA → Ac]

   → aaabbAccc       [bA → bb]

   → aaabbbccc       [bA → bb] 

1 comment

Because of cA --> Ac is not in CSG isn't it? Can u write CSG grammar for this
0
0

Related questions