Title: context sensitive languages
1GRAMMARS Equal number of as, bs and cs
2GRAMMARS Equal number of as, bs and cs
3GRAMMARS Equal number of as, bs and cs
4GRAMMARS Equal number of as, bs and cs
5Lan bn cnngt1
6Formal parameters
Lan bn cnngt1
Procedure declaration
7Actual parameters
Lan bn cnngt1
Procedure calls
Procedure declaration
8A csg for Lan bn cnngt1
9S?aSBC S?a n-1 S(BC)n-1
10S?aSBC S?a n-1 S(BC)n-1 S?aBC S?a
n (BC)n
11S?aSBC S?a n-1 S(BC)n-1 S?aBC S?a
n (BC)n
aB?ab S?a n bC(BC)n-1
12S?aSBC S?a n-1 S(BC)n-1 S?aBC S?a
n (BC)n
aB?ab S?a n bC(BC)n-1
CB?BC S?a n b Bn-1Cn
13S?aSBC S?a n-1 S(BC)n-1 S?aBC S?a
n (BC)n
aB?ab S?a n bC(BC)n-1
CB?BC S?a n b Bn-1Cn
bB?bb S?a n b nCn
14S?aSBC S?a n-1 S(BC)n-1 S?aBC S?a
n (BC)n
aB?ab S?a n bC(BC)n-1
CB?BC S?a n b Bn-1Cn
bB?bb S?a n b nCn
15S?aSBC S?a n-1 S(BC)n-1 S?aBC S?a
n (BC)n
aB?ab S?a n bC(BC)n-1
CB?BC S?a n b Bn-1Cn
bB?bb S?a n b nCn bC?bc S?a n
bncCn-1
16S?aSBC S?a n-1 S(BC)n-1 S?aBC S?a
n (BC)n
aB?ab S?a n bC(BC)n-1
CB?BC S?a n b Bn-1Cn
bB?bb S?a n b nCn bC?bc S?a n
bncCn-1 cC?cc S?a n bncn In the
above rules ngt1
17RULE LENGTH OF LHS LENGTH OF RHS COMPARISON OF LENGTHS
S?aSBC 1 4 RHSgtLHS
18RULE LENGTH OF LHS LENGTH OF RHS COMPARISON OF LENGTHS
S?aSBC 1 4 RHSgtLHS
S?aBC 1 3 RHSgtLHS
19RULE LENGTH OF LHS LENGTH OF RHS COMPARISON OF LENGTHS
S?aSBC 1 4 RHSgtLHS
S?aBC 1 3 RHSgtLHS
aB?ab 2 2 RHSLHS
20RULE LENGTH OF LHS LENGTH OF RHS COMPARISON OF LENGTHS
S?aSBC 1 4 RHSgtLHS
S?aBC 1 3 RHSgtLHS
aB?ab 2 2 RHSLHS
CB?BC 2 2 RHSLHS
21RULE LENGTH OF LHS LENGTH OF RHS COMPARISON OF LENGTHS
S?aSBC 1 4 RHSgtLHS
S?aBC 1 3 RHSgtLHS
aB?ab 2 2 RHSLHS
CB?BC 2 2 RHSLHS
bB?bb 2 2 RHSLHS
22RULE LENGTH OF LHS LENGTH OF RHS COMPARISON OF LENGTHS
S?aSBC 1 4 RHSgtLHS
S?aBC 1 3 RHSgtLHS
aB?ab 2 2 RHSLHS
CB?BC 2 2 RHSLHS
bB?bb 2 2 RHSLHS
bC?bc 2 2 RHSLHS
23RULE LENGTH OF LHS LENGTH OF RHS COMPARISON OF LENGTHS
S?aSBC 1 4 RHSgtLHS
S?aBC 1 3 RHSgtLHS
aB?ab 2 2 RHSLHS
CB?BC 2 2 RHSLHS
bB?bb 2 2 RHSLHS
bC?bc 2 2 RHSLHS
cC?cc 2 2 RHSLHS
24A sample derivation The string aaabbb
ccc
25RULE The derivation
S?aSBC S?aSBC
S?aBC
aB?ab
CB?BC
bB?bb
bC?bc
cC?cc
26RULE The derivation
S?aSBC S?aSBC ?aaSBCBC
S?aBC
aB?ab
CB?BC
bB?bb
bC?bc
cC?cc
27RULE The derivation
S?aSBC S?aSBC ?aaSBCBC
S?aBC ?aaaBCBCBC
aB?ab
CB?BC
bB?bb
bC?bc
cC?cc
28RULE The derivation
S?aSBC S?aSBC ?aaSBCBC
S?aBC ?aaaBCBCBC
aB?ab ?aaabCBCBC
CB?BC
bB?bb
bC?bc
cC?cc
29RULE The derivation
S?aSBC S?aSBC ?aaSBCBC
S?aBC ?aaaBCBCBC
aB?ab ?aaabCBCBC
CB?BC ?aaabCCBBC
bB?bb
bC?bc
cC?cc
30RULE The derivation
S?aSBC S?aSBC ?aaSBCBC
S?aBC ?aaaBCBCBC
aB?ab ?aaabCBCBC
CB?BC ?aaabCCBBC ?aaabCBCBC
bB?bb
bC?bc
cC?cc
31RULE The derivation
S?aSBC S?aSBC ?aaSBCBC
S?aBC ?aaaBCBCBC
aB?ab ?aaabCBCBC
CB?BC ?aaabCCBBC ?aaabCBCBC -gtaaabBCCBC
bB?bb
bC?bc
cC?cc
32RULE The derivation
S?aSBC S?aSBC ?aaSBCBC
S?aBC ?aaaBCBCBC
aB?ab ?aaabCBCBC
CB?BC ?aaabCCBBC ?aaabCBCBC -gtaaabBCCBC
?aaabBCBCC
bB?bb
bC?bc
cC?cc
33RULE The derivation
S?aSBC S?aSBC ?aaSBCBC
S?aBC ?aaaBCBCBC
aB?ab ?aaabCBCBC
CB?BC ?aaabCCBBC ?aaabCBCBC -gtaaabBCCBC
?aaabBCBCC ?aaabBBCCC
bB?bb
bC?bc
cC?cc
34RULE The derivation
S?aSBC S?aSBC ?aaSBCBC
S?aBC ?aaaBCBCBC
aB?ab ?aaabCBCBC
CB?BC ?aaabCCBBC ?aaabCBCBC -gtaaabBCCBC
?aaabBCBCC ?aaabBBCCC
bB?bb ?aaabbBCCC
bC?bc
cC?cc
35RULE The derivation
S?aSBC S?aSBC ?aaSBCBC
S?aBC ?aaaBCBCBC
aB?ab ?aaabCBCBC
CB?BC ?aaabCCBBC ?aaabCBCBC -gtaaabBCCBC
?aaabBCBCC ?aaabBBCCC
bB?bb ?aaabbBCCC ?aaabbbCCC
bC?bc ?aaabbbcCC
cC?cc
36RULE The derivation
S?aSBC S?aSBC ?aaSBCBC
S?aBC ?aaaBCBCBC
aB?ab ?aaabCBCBC
CB?BC ?aaabCCBBC ?aaabCBCBC -gtaaabBCCBC
?aaabBCBCC ?aaabBBCCC
bB?bb ?aaabbBCCC ?aaabbbCCC
bC?bc ?aaabbbcCC
cC?cc ?aaabbbccC
37RULE The derivation
S?aSBC S?aSBC ?aaSBCBC
S?aBC ?aaaBCBCBC
aB?ab ?aaabCBCBC
CB?BC ?aaabCCBBC ?aaabCBCBC -gtaaabBCCBC
?aaabBCBCC ?aaabBBCCC
bB?bb ?aaabbBCCC ?aaabbbCCC
bC?bc ?aaabbbcCC
cC?cc ?aaabbbccC ?aaabbbccc
38IN ALL RULES Length of rhs gt length of lhs
39The grammar is a context-sensitive grammar(csg)
IN ALL RULES Length of rhs gt length of lhs
40No cfg can generate This language So csls are a
bigger class Than cfls
41cfls cfgs
42csls ans csgs
cfls cfgs
cfls and cfgs
43END