74
1 Normal Forms for Context-free Grammars

Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

1

Normal Formsfor

Context-free Grammars

Page 2: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

Linz 6th, Section 6.2

“Two Important Normal Forms,”

pages 171--178

2

Page 3: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

3

Chomsky Normal Form

All productions have form:

BCA

variable variable

aAand

terminal

Page 4: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

4

Examples:

bA

SAA

aS

ASS

Not Chomsky

Normal Form

aaA

SAA

AASS

ASS

Chomsky

Normal Form

Page 5: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

5

Conversion to Chomsky Normal Form

Example:

AcB

aabA

ABaS

Not Chomsky

Normal Form

Page 6: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

6

AcB

aabA

ABaS

Introduce variables for terminals:

cT

bT

aT

ATB

TTTA

ABTS

c

b

a

c

baa

a

cba TTT ,,

Page 7: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

7

Introduce intermediate variable:

cT

bT

aT

ATB

TTTA

ABTS

c

b

a

c

baa

a

cT

bT

aT

ATB

TTTA

BTV

AVS

c

b

a

c

baa

a

1

1

1V

Page 8: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

8

Introduce intermediate variable:

cT

bT

aT

ATB

TTV

VTA

BTV

AVS

c

b

a

c

ba

a

a

2

2

1

1

2V

cT

bT

aT

ATB

TTTA

BTV

AVS

c

b

a

c

baa

a

1

1

Page 9: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

9

Final grammar in Chomsky Normal Form:

cT

bT

aT

ATB

TTV

VTA

BTV

AVS

c

b

a

c

ba

a

a

2

2

1

1

AcB

aabA

ABaS

Initial grammar

Page 10: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

10

From any context-free grammar

not in Chomsky Normal Form

we can obtain:

An equivalent grammar

in Chomsky Normal Form

In general:

Page 11: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

11

The Procedure

First remove:

Nullable variables

Unit productions

Page 12: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

12

For every symbol : a

In productions: replace with a aT

Add production aTa

New variable: aT

Page 13: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

13

Replace any productionnCCCA 21

with

nnn CCV

VCV

VCA

12

221

11

New intermediate variables: 221 ,,, nVVV

Page 14: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

14

Theorem: For any context-free grammar G such that the empty string is not in L(G), there is an equivalent grammar in Chomsky Normal Form

Linz, 6th, Theorem 6.6, page 172.

Page 15: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

15

Observations

• Chomsky normal forms are good

for parsing and proving theorems

• It is very easy to find the Chomsky normal

form of any context-free grammar

Page 16: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

16

Greibach Normal Form

All productions have form:

kVVVaA 21

symbol variables

0k

Page 17: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

17

Examples:

bB

bbBaAA

cABS

||

Greibach

Normal Form

aaS

abSbS

Not Greibach

Normal Form

Page 18: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

18

aaS

abSbS

Conversion to Greibach Normal Form:

bT

aT

aTS

STaTS

b

a

a

bb

Greibach

Normal Form

Page 19: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

19

Theorem: For any context-free grammar

G such that the empty string is not in L(G), there is an equivalent grammar

in Greibach Normal Form

Linz, 6th, Theorem 6.7, page 176.Proof not given because it is too

complicated.

Page 20: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

20

Observations

• Greibach normal forms are very good

for parsing

• It is hard to find the Greibach normal

form of any context-free grammar

Page 21: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

21

An Applicationof

Chomsky Normal Forms

Page 22: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

22

The CYK Membership Algorithm

J. Cocke, D. H. Younger, and T. KasamiInput:

• Grammar in Chomsky Normal Form G

• String

Output:

find if )(GLw

w

Page 23: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

Considers every possible consecutive subsequence of letters and sets K∈T[i,j] if the sequence of letters starting from i to j can be generated from the non-terminal K.

Once it has considered sequences of length

1, it goes on to sequences of length 2, and so on.

23

Page 24: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

For subsequences of length 2 and greater, it considers every possible partition of the subsequence into two halves, and checks to see if there is some production A-> BC such that B matches the first half and C Matches the second half. If so, it records A as matching the whole subsequence.

Once this process is completed, the sentence is recognized by the grammar if the entire string is matched by the start symbol.

24

Page 25: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

25

The Algorithm

• Grammar :G

bB

ABB

aA

BBA

ABS

• String : w aabbb

Input example:

Page 26: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

26

[0:1]

[1:2] [2:3] [3:4] [4:5]

[0:2] [1:3] [2:4] [3:5]

[0:3] [1:4] [2:5]

[0:4] [1:5]

[0:5]

aabbb

Page 27: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

27

a a b b b

aa ab bb bb

aab abb bbb

aabb abbb

aabbb

aabbb

Page 28: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

28

a

A

a

A

b

B

b

B

b

B

aa ab bb bb

aab abb bbb

aabb abbb

aabbb

bB

ABB

aA

BBA

ABS

Page 29: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

29

a

A

a

A

b

B

b

B

b

B

aa ab

S,B

bb

A

bb

A

aab abb bbb

aabb abbb

aabbb

bB

ABB

aA

BBA

ABS

Page 30: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

30

a

A

a

A

b

B

b

B

b

B

aa ab

S,B

bb

A

bb

A

aab

S,B

abb

A

bbb

S,B

aabb

A

abbb

S,B

aabbb

S,B

bB

ABB

aA

BBA

ABS

Page 31: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

31

Therefore: )(GLaabbb

Time Complexity:3|| w

The CYK algorithm can be

easily converted to a parser

Observation:

Page 32: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

32

Pushdown AutomataPDAs

Page 33: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

33

Pushdown Automaton -- PDA

Input String

Stack

States

Page 34: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

34

Initial Stack Symbol

Stack

$

Stack

z

bottomspecial symbol

Page 35: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

35

The States

q1 q2a, b c

Input

symbol

Pop

symbolPush

symbol

Page 36: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

36

q1 q2a, b c

a

b top

input

stack

a

Replaceeh

$eh

$

c

Page 37: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

37

q1 q2a, c

a a

Pushb

eh

$eh

$

b

c

top

input

stack

Page 38: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

38

q1 q2a, b

a a

Popb

eh

$eh

$

top

input

stack

Page 39: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

39

q1 q2a,

a a

No Changeb

eh

$eh

$

btop

input

stack

Page 40: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

40

Non-Determinism

q1

q2a, b c

q3a, b c

q1 q2, b c

transition

These are allowed transitions in

a Non-deterministic PDA (NPDA)

Page 41: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

41

NPDA: Non-Deterministic PDA

Example:

,

a, a

b, aq0 q1 q2 q3

b, a

, $ $

Page 42: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

42

a, a

b, a0q q1 q2 q3

Execution Example:

Input

a a a b b b

current

state

b, a

Time 0

, , $ $

Stack

$

Page 43: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

43

a, a

b, aq0 q1 q2 q3

Input

a a a b b b

b, a

Time 1

, , $ $

Stack

$

Page 44: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

44

a, a

b, aq0 q1 q2 q3

Input

Stack

a a a b b b

$

a

b, a

Time 2

, , $ $

Page 45: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

45

a, a

b, aq0 q1 q2 q3

Input

Stack

a a a b b b

$

a

a

b, a

Time 3

, , $ $

Page 46: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

46

a, a

b, aq0 q1 q2 q3

Input

Stack

a a a b b b

$

a

a

a

b, a

Time 4

, , $ $

Page 47: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

47

a, a

b, aq0 q1 q2 q3

Input

a a a b b b

Stack

$

a

a

a

b, a

Time 5

, , $ $

Page 48: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

48

a, a

b, aq0 q1 q2 q3

Input

a a a b b b

$

a

Stack

b, a

Time 6

, , $ $

a

Page 49: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

49

a, a

b, aq0 q1 q2 q3

Input

a a a b b b

$

Stack

b, a

Time 7

, , $ $

a

Page 50: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

50

a, a

b, aq0 q1 q2 q3

Input

a a a b b b

b, a

Time 8

accept

, , $ $

$

Stack

Page 51: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

51

A string is accepted if there is

a computation such that:

• All the input is consumed

• The last state is a final state

At the end of the computation,

we do not care about the stack contents

Page 52: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

52

The input string

is accepted by the NPDA:

aaabbb

a, a

b, aq0 q1 q2 q3

b, a

, , $ $

Page 53: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

53

}0:{ nbaL nn

is the language accepted by the NPDA:

a, a

b, aq0 q1 q2 q3

b, a

In general,

, , $ $

Page 54: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

54

Another NPDA example

, $ $q1

q2

bb

aa

,

,

, q0

bb

aa

,

,

NPDA M

}{)( RwwML

Page 55: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

55

Execution Example:

Input

Time 0

Stack

$

, $ $q1

q2

bb

aa

,

,

, q0

bb

aa

,

,

a ab b

Page 56: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

56

Input

a ab

Time 1

Stack

$

, $ $q1

q2

bb

aa

,

,

, q0

bb

aa

,

,

ab

Page 57: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

57

Input

Time 2

Stack

$

, $ $q1

q2

bb

aa

,

,

, q0

bb

aa

,

,

aa ab b

b

Page 58: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

58

Input

Time 3

Stack

$

, $ $q1

q2

bb

aa

,

,

, q0

bb

aa

,

,

aa ab b

b

Guess the middle

of string

Page 59: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

59

Input

Time 4

Stack

$

, $ $q1

q2

bb

aa

,

,

, q0

bb

aa

,

,

aa ab b

b

Page 60: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

60

Input

Time 5

Stack

$

, $ $1q q2

bb

aa

,

,

, q0

bb

aa

,

,

a ab b a

Page 61: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

61

Input

Time 6

Stack

$

, $ $q1

bb

aa

,

,

, q0

bb

aa

,

,

a ab b

accept

q2

Page 62: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

62

Rejection Example:

Input

Time 0

Stack

$

, $ $q1

q2

bb

aa

,

,

, q0

bb

aa

,

,

a b b b

Page 63: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

63

Input

Time 1

Stack

$

, $ $q1

q2

bb

aa

,

,

, q0

bb

aa

,

,

aa b b b

Page 64: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

64

Input

Time 2

Stack

$

, $ $q1

q2

bb

aa

,

,

, q0

bb

aa

,

,

a

ba b b b

Page 65: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

65

Input

Time 3

Stack

$

, $ $q1

q2

bb

aa

,

,

, q0

bb

aa

,

,

a

b

Guess the middle

of string

a b b b

Page 66: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

66

Input

Time 4

Stack

$

, $ $q1

q2

bb

aa

,

,

, q0

bb

aa

,

,

a

ba b b b

Page 67: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

67

Input

Time 5

Stack

$

, $ $1q q2

bb

aa

,

,

, q0

bb

aa

,

,

aa b b b

There is no possible transition.

Input is not consumed

Page 68: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

68

Another computation on same string:

Input Time 0

Stack

$

, $ $q1

q2

bb

aa

,

,

, q0

bb

aa

,

,

a b b b

Page 69: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

69

Input

Time 1

Stack

$

, $ $q1

q2

bb

aa

,

,

, q0

bb

aa

,

,

aa b b b

Page 70: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

70

Input

Time 2

Stack

$

, $ $q1

q2

bb

aa

,

,

, q0

bb

aa

,

,

a

ba b b b

Page 71: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

71

Input

Time 3

Stack

$

a

ba b b b

, $ $q1

q2

bb

aa

,

,

, q0

bb

aa

,

,

b

Page 72: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

72

Input

Time 4

Stack

a b b b

, $ $q1

q2

bb

aa

,

,

, q0

bb

aa

,

,

$

a

b

b

b

Page 73: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

73

Input

Time 5

Stack

a b b b

$

a

b

b

b

, $ $q1

q2

bb

aa

,

,

, q0

bb

aa

,

,

No final state

is reached

Page 74: Normal Forms for Context-free Grammarsryan/cse4083/busch/class10.pdf · 2017. 2. 22. · Theorem: For any context-free grammar G such that the empty string is not in L(G), there is

74

, $ $q1

q2

bb

aa

,

,

, q0

bb

aa

,

,

There is no computation

that accepts string abbb

)(MLabbb