PPT: Pushdown Automata (PDA) | Theory of Computation - Computer Science Engineering (CSE) PDF Download

Download, print and study this document offline
Please wait while the PDF view is loading
 Page 1


1
Pushdown Automata (PDA)
Page 2


1
Pushdown Automata (PDA)
2
PDA - the automata for CFLs
n What is?
n FA to Reg Lang, PDA is to CFL
n PDA == [ e -NFA + “a stack” ]
n Why a stack?
e-NFA
A stack filled with “stack symbols”
Input
string
Accept/reject
Page 3


1
Pushdown Automata (PDA)
2
PDA - the automata for CFLs
n What is?
n FA to Reg Lang, PDA is to CFL
n PDA == [ e -NFA + “a stack” ]
n Why a stack?
e-NFA
A stack filled with “stack symbols”
Input
string
Accept/reject
3
Pushdown Automata -
Definition
n A PDA P := ( Q, ?, G, d,q
0
,Z
0
,F ):
n Q: states of the e-NFA
n ?: input alphabet
n G : stack symbols
n d: transition function
n q
0
: start state
n Z
0
: Initial stack top symbol
n F: Final/accepting states
Page 4


1
Pushdown Automata (PDA)
2
PDA - the automata for CFLs
n What is?
n FA to Reg Lang, PDA is to CFL
n PDA == [ e -NFA + “a stack” ]
n Why a stack?
e-NFA
A stack filled with “stack symbols”
Input
string
Accept/reject
3
Pushdown Automata -
Definition
n A PDA P := ( Q, ?, G, d,q
0
,Z
0
,F ):
n Q: states of the e-NFA
n ?: input alphabet
n G : stack symbols
n d: transition function
n q
0
: start state
n Z
0
: Initial stack top symbol
n F: Final/accepting states
d : The Transition Function
d(q,a,X) = {(p,Y), …}
1. state transition from q to p
2. a is the next input symbol
3. X is the current stack top symbol
4. Y is the replacement for X;
it is in G* (a string of stack
symbols)
i. Set Y = e for: Pop(X)
ii. If Y=X: stack top is
unchanged
iii. If Y=Z
1
Z
2
…Z
k
: X is popped
and is replaced by Y in
reverse order (i.e., Z
1
will be
the new stack top)
4
old state Stack top input symb.
new state(s) new Stack top(s)
d : Q x ? x G => Q x G
q
a
X
p
Y
Y = ? Action
i) Y=e Pop(X)
ii) Y=X Pop(X)
Push(X)
iii) Y=Z
1
Z
2
..Z
k
Pop(X)
Push(Z
k
)
Push(Z
k-1
)
…
Push(Z
2
)
Push(Z
1
)
Page 5


1
Pushdown Automata (PDA)
2
PDA - the automata for CFLs
n What is?
n FA to Reg Lang, PDA is to CFL
n PDA == [ e -NFA + “a stack” ]
n Why a stack?
e-NFA
A stack filled with “stack symbols”
Input
string
Accept/reject
3
Pushdown Automata -
Definition
n A PDA P := ( Q, ?, G, d,q
0
,Z
0
,F ):
n Q: states of the e-NFA
n ?: input alphabet
n G : stack symbols
n d: transition function
n q
0
: start state
n Z
0
: Initial stack top symbol
n F: Final/accepting states
d : The Transition Function
d(q,a,X) = {(p,Y), …}
1. state transition from q to p
2. a is the next input symbol
3. X is the current stack top symbol
4. Y is the replacement for X;
it is in G* (a string of stack
symbols)
i. Set Y = e for: Pop(X)
ii. If Y=X: stack top is
unchanged
iii. If Y=Z
1
Z
2
…Z
k
: X is popped
and is replaced by Y in
reverse order (i.e., Z
1
will be
the new stack top)
4
old state Stack top input symb.
new state(s) new Stack top(s)
d : Q x ? x G => Q x G
q
a
X
p
Y
Y = ? Action
i) Y=e Pop(X)
ii) Y=X Pop(X)
Push(X)
iii) Y=Z
1
Z
2
..Z
k
Pop(X)
Push(Z
k
)
Push(Z
k-1
)
…
Push(Z
2
)
Push(Z
1
)
5
Example
Let L
wwr
= {ww
R
| w is in (0+1)*}
n CFG for L
wwr
: S==> 0S0 | 1S1 | e
n PDA for L
wwr
:
n P := ( Q, ?, G, d,q
0
,Z
0
,F)
= ( {q
0
, q
1
, q
2
},{0,1},{0,1,Z
0
}, d,q
0
,Z
0
,{q
2
})
Read More
18 videos|69 docs|44 tests

Top Courses for Computer Science Engineering (CSE)

FAQs on PPT: Pushdown Automata (PDA) - Theory of Computation - Computer Science Engineering (CSE)

1. What is a Pushdown Automata (PDA) in Computer Science Engineering (CSE)?
Ans. A Pushdown Automata (PDA) is a computational model used in Computer Science Engineering (CSE) to describe and analyze the behavior of certain types of languages. It is an extension of a finite automaton with an additional stack memory, which allows it to recognize context-free languages.
2. How does a Pushdown Automata (PDA) work?
Ans. A Pushdown Automata (PDA) works by reading input symbols from an input tape and manipulating its stack memory based on the current state and input symbol. It can perform three operations - push, pop, and stay idle. The PDA transitions from one state to another based on these operations and the input symbols, until it reaches an accepting state or the input is exhausted.
3. What is the role of the stack in a Pushdown Automata (PDA)?
Ans. The stack in a Pushdown Automata (PDA) serves as a memory that allows the PDA to store information temporarily. It is used to keep track of the context and enforce constraints in the languages recognized by the PDA. The stack enables the PDA to perform operations like push and pop, which allow it to handle nested structures in the input.
4. What is the difference between a Pushdown Automata (PDA) and a finite automaton?
Ans. The main difference between a Pushdown Automata (PDA) and a finite automaton is the presence of an additional stack memory in PDAs. While finite automata can only recognize regular languages, PDAs can recognize context-free languages. PDAs have more computational power due to the stack, which enables them to handle nested structures and enforce context-sensitive constraints.
5. How are Pushdown Automata (PDAs) useful in Computer Science Engineering (CSE)?
Ans. Pushdown Automata (PDAs) are useful in Computer Science Engineering (CSE) for various purposes. They are used in the design and analysis of programming languages, compilers, and parsers. PDAs help in studying the properties of context-free languages and their corresponding grammars. They also play a crucial role in parsing techniques, such as LL(k) and LR(k), which are fundamental in language processing and compiler construction.
18 videos|69 docs|44 tests
Download as PDF
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Free

,

Objective type Questions

,

past year papers

,

Extra Questions

,

practice quizzes

,

PPT: Pushdown Automata (PDA) | Theory of Computation - Computer Science Engineering (CSE)

,

Previous Year Questions with Solutions

,

Exam

,

video lectures

,

PPT: Pushdown Automata (PDA) | Theory of Computation - Computer Science Engineering (CSE)

,

Important questions

,

Viva Questions

,

Sample Paper

,

study material

,

shortcuts and tricks

,

mock tests for examination

,

PPT: Pushdown Automata (PDA) | Theory of Computation - Computer Science Engineering (CSE)

,

Semester Notes

,

Summary

,

ppt

,

pdf

,

MCQs

;