1,646 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?

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] 

Related questions

0 votes
0 votes
2 answers
1
Ravi prakash pandey asked Apr 7, 2018
594 views
it is given that in csg if @->#then length of @ should be less or equal to #then how aaB->c is a csg???
0 votes
0 votes
0 answers
2
3 votes
3 votes
2 answers
3
1 votes
1 votes
1 answer
4