context sensitive languages - PowerPoint PPT Presentation

About This Presentation
Title:

context sensitive languages

Description:

A problem in the Theory of Computation – PowerPoint PPT presentation

Number of Views:35
Slides: 44
Provided by: etenneti
Category: Entertainment

less

Transcript and Presenter's Notes

Title: context sensitive languages


1
GRAMMARS Equal number of as, bs and cs
2
GRAMMARS Equal number of as, bs and cs
3
GRAMMARS Equal number of as, bs and cs
4
GRAMMARS Equal number of as, bs and cs
5
Lan bn cnngt1
6
Formal parameters
Lan bn cnngt1
Procedure declaration
7
Actual parameters
Lan bn cnngt1
Procedure calls
Procedure declaration
8
A csg for Lan bn cnngt1
9
S?aSBC S?a n-1 S(BC)n-1
10
S?aSBC S?a n-1 S(BC)n-1 S?aBC S?a
n (BC)n
11
S?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
12
S?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
13
S?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
14
S?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
15
S?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
16
S?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
17
RULE LENGTH OF LHS LENGTH OF RHS COMPARISON OF LENGTHS
S?aSBC 1 4 RHSgtLHS






18
RULE LENGTH OF LHS LENGTH OF RHS COMPARISON OF LENGTHS
S?aSBC 1 4 RHSgtLHS
S?aBC 1 3 RHSgtLHS





19
RULE LENGTH OF LHS LENGTH OF RHS COMPARISON OF LENGTHS
S?aSBC 1 4 RHSgtLHS
S?aBC 1 3 RHSgtLHS
aB?ab 2 2 RHSLHS




20
RULE 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



21
RULE 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


22
RULE 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

23
RULE 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
24
A sample derivation The string aaabbb
ccc
25
RULE The derivation
S?aSBC S?aSBC
S?aBC
aB?ab
CB?BC

bB?bb
bC?bc
cC?cc
26
RULE The derivation
S?aSBC S?aSBC ?aaSBCBC
S?aBC
aB?ab
CB?BC

bB?bb
bC?bc
cC?cc
27
RULE The derivation
S?aSBC S?aSBC ?aaSBCBC
S?aBC ?aaaBCBCBC
aB?ab
CB?BC

bB?bb
bC?bc
cC?cc
28
RULE The derivation
S?aSBC S?aSBC ?aaSBCBC
S?aBC ?aaaBCBCBC
aB?ab ?aaabCBCBC
CB?BC

bB?bb
bC?bc
cC?cc
29
RULE The derivation
S?aSBC S?aSBC ?aaSBCBC
S?aBC ?aaaBCBCBC
aB?ab ?aaabCBCBC
CB?BC ?aaabCCBBC

bB?bb
bC?bc
cC?cc
30
RULE The derivation
S?aSBC S?aSBC ?aaSBCBC
S?aBC ?aaaBCBCBC
aB?ab ?aaabCBCBC
CB?BC ?aaabCCBBC ?aaabCBCBC

bB?bb
bC?bc
cC?cc
31
RULE The derivation
S?aSBC S?aSBC ?aaSBCBC
S?aBC ?aaaBCBCBC
aB?ab ?aaabCBCBC
CB?BC ?aaabCCBBC ?aaabCBCBC -gtaaabBCCBC

bB?bb
bC?bc
cC?cc
32
RULE 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
33
RULE 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
34
RULE 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
35
RULE 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
36
RULE 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
37
RULE 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
38
IN ALL RULES Length of rhs gt length of lhs
39
The grammar is a context-sensitive grammar(csg)
IN ALL RULES Length of rhs gt length of lhs
40
No cfg can generate This language So csls are a
bigger class Than cfls
41
cfls cfgs
42
csls ans csgs
cfls cfgs
cfls and cfgs
43
END
Write a Comment
User Comments (0)
About PowerShow.com