Pushdown Automata PDAs - PowerPoint PPT Presentation

About This Presentation
Title:

Pushdown Automata PDAs

Description:

1. Pushdown Automata. PDAs. 2. Pushdown Automaton -- PDA ... Non-Deterministic Pushdown Automaton. NPDA. States. Input. alphabet. Stack. alphabet. Transition ... – PowerPoint PPT presentation

Number of Views:229
Avg rating:3.0/5.0
Slides: 78
Provided by: costas
Learn more at: http://www.cs.rpi.edu
Category:

less

Transcript and Presenter's Notes

Title: Pushdown Automata PDAs


1
Pushdown AutomataPDAs

2
Pushdown Automaton -- PDA
Input String
Stack
States
3
Initial Stack Symbol
Stack
Stack
bottom
special symbol
4
The States
Pop symbol
Input symbol
Push symbol
5
input
stack
top
6
input
stack
top
7
input
stack
top
8
input
stack
top
9
Non-Determinism
10
NPDA Non-Deterministic PDA
Example
11
Execution Example
Time 0
Input
Stack
current state
12
Time 1
Input
Stack
13
Time 2
Input
Stack
14
Time 3
Input
Stack
15
Time 4
Input
Stack
16
Time 5
Input
Stack
17
Time 6
Input
Stack
18
Time 7
Input
Stack
19
Time 8
Input
Stack
accept
20
A string is accepted if
  • All the input is consumed
  • The last state is a final state

We do not care about the stack contents
21
The input string is accepted by the NPDA
22
In general,
is the language accepted by the NPDA
23
Another NPDA example
NPDA
24
(No Transcript)
25
Execution Example
Time 0
Input
Stack
26
Time 1
Input
Stack
27
Time 2
Input
Stack
28
Time 3
Input
Stack
29
Time 4
Input
Stack
30
Time 5
Input
Stack
31
Time 6
Input
Stack
accept
32
Pushing Strings
Pop symbol
Input symbol
Push string
33
Example
input
pushed string
stack
top
34
Another NPDA example
NPDA
35
(No Transcript)
36
Execution
Time 0
Input
Stack
current state
37
Time 1
Input
Stack
38
Time 3
Input
Stack
39
Time 4
Input
Stack
40
Time 5
Input
Stack
41
Time 6
Input
Stack
42
Time 7
Input
Stack
43
Time 8
Input
Stack
accept
44
Formalities for NPDAs

45
Transition function
46
Transition function
47
Formal Definition
Non-Deterministic Pushdown Automaton
NPDA
Final states
States
Input alphabet
Stack start symbol
Transition function
Stack alphabet
48
Instantaneous Description
Current state
Current stack contents
Remaining input
49
Example
Instantaneous Description
Input
Time 4
Stack
50
Example
Instantaneous Description
Input
Time 5
Stack
51
We write
(Time 4)
(Time 5)
52
A computation
53
For convenience we write
54
Formal Definition
Language of NPDA
Start state
Final state
55
Example
thus
NPDA
56
thus
NPDA
57
Therefore
NPDA
58
Converting Context-Free Grammarsto NPDAs

59
An example grammar
What is the equivalent NPDA?
60
Grammar
NPDA
61
The NPDA simulates leftmost derivations of the
grammar
L(grammar) L(NPDA)
62
Grammar
A leftmost derivation
63
NPDA execution
Time 0
Input
Stack
current state
64
Time 1
Input
Stack
65
Time 2
Input
Stack
66
Time 3
Input
Stack
67
Time 4
Input
Stack
68
Time 5
Input
Stack
69
Time 6
Input
Stack
70
Time 7
Input
Stack
71
Time 8
Input
Stack
72
Time 9
Input
Stack
73
Time 10
Input
Stack
accept
74
In general
Given any grammar
We can construct a NPDA
With
75
Constructing NPDA from grammar
For any production
For any terminal
76
Grammar generates string
if and only if
NPDA accepts
77
Therefore
For any context-free language there is an
NPDA that accepts the same language
Write a Comment
User Comments (0)
About PowerShow.com