nfsa simulation with deque

25
1 NFSA Simulation with Deque a 1 2 3 b 4 5 a 6 7 8 c 9 10 11 12 d 13 start accep t a a b d a Input Text top botto m state label Deque a a a a a a a a a a a -1 a a a

Upload: jaclyn

Post on 15-Jan-2016

41 views

Category:

Documents


0 download

DESCRIPTION

NFSA Simulation with Deque. Deque. Input Text. a. a. a. -1. a. a. a. a. a. a. a. a. a. a. a. a. a. b. d. a. top. bottom. state. label. a. . c. . 6. 7. 8. 9. . . d. 10. . 11. 12. 13. start. accept. . a. . . b. 1. 2. 3. 4. 5. . - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: NFSA Simulation with Deque

1

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

state

label

Deque

aaaaaaaaaaa-1aaa

Page 2: NFSA Simulation with Deque

2

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

10state

label

Deque

aaaaaaaaaaa-1aaa 36

Push 3 and 6 since label =

Page 3: NFSA Simulation with Deque

3

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

6state

alabel

Deque

aaaaaaaaaaa-13aa 7

Enqueue 7 since label matches

Page 4: NFSA Simulation with Deque

4

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

3state

label

Deque

aaaaaaaaaa7-13aa 14

Push 1 and 4 since label =

Page 5: NFSA Simulation with Deque

5

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

4state

blabel

Deque

aaaaaaaaaa7-11aa

Do nothing since label mismatches

Page 6: NFSA Simulation with Deque

6

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

1state

alabel

Deque

aaaaaaaaaa7-11aa 2

Enqueue 2 since label matches

Page 7: NFSA Simulation with Deque

7

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

-1state

label

Deque

aaaaaaaaa27-11aa

Enqueue -1 and advance input

-1

Page 8: NFSA Simulation with Deque

8

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

-1state

label

Deque

aaaaaaaa-127-11aa

Enqueue -1 and advance input

Page 9: NFSA Simulation with Deque

9

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

7state

label

Deque

aaaaaaaa-127-11aa 8

Push 8 since label =

Page 10: NFSA Simulation with Deque

10

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

8state

clabel

Deque

aaaaaaaa-127-11aa

Do nothing since label mismatches

Page 11: NFSA Simulation with Deque

11

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

2state

label

Deque

aaaaaaaa-127-11aa 3

Push 3 since label =

Page 12: NFSA Simulation with Deque

12

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

3state

label

Deque

aaaaaaaa-127-11aa 14

Push 1 and 4 since label =

Page 13: NFSA Simulation with Deque

13

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

4state

blabel

Deque

aaaaaaaa-117-11aa

Do nothing since label mismatches

Page 14: NFSA Simulation with Deque

14

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

1state

alabel

Deque

aaaaaaaa-117-11aa 2

Enqueue 2 since label matches

Page 15: NFSA Simulation with Deque

15

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

-1state

label

Deque

aaaaaaa2-117-11aa -1

Enqueue -1 and advance input

Page 16: NFSA Simulation with Deque

16

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

2state

label

Deque

aaaaaa-12-117-11aa 3

Push 3 since label =

Page 17: NFSA Simulation with Deque

17

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

3state

label

Deque

aaaaaa-12-117-11aa 14

Push 1 and 4 since label =

Page 18: NFSA Simulation with Deque

18

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

4state

label

Deque

aaaaaa-11-117-11aa 5

Enqueue 5 since label matches

Page 19: NFSA Simulation with Deque

19

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

1state

alabel

Deque

aaaaa5-11-117-11aa

Do nothing since label mismatches

Page 20: NFSA Simulation with Deque

20

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

-1state

label

Deque

aaaaa5-11-117-11aa -1

Enqueue -1 and advance input

Page 21: NFSA Simulation with Deque

21

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

5state

label

Deque

aaaa-15-11-117-11aa 11

Push 11 since label =

Page 22: NFSA Simulation with Deque

22

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

11state

label

Deque

aaaa-15-11-117-11aa 12

Push 12 since label =

Page 23: NFSA Simulation with Deque

23

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

12state

dlabel

Deque

aaaa-15-11-117-11aa 13

Enqueue 13 since label matches

Page 24: NFSA Simulation with Deque

24

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

-1state

label

Deque

aaa13-15-11-117-11aa -1

Enqueue -1 and advance input

Page 25: NFSA Simulation with Deque

25

NFSA Simulation with Deque

a1 2

3

b4 5

a6 7

8

c9

10

11

12d

13

start accept

a a b d a

Input Text

top bottom

13state

label

Deque

aa-1-15-11-117-11aa

STOP: match found