





































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
How to convert context-free grammars (cfgs) into pushdown automata (pdas), a type of automaton used to recognize the languages defined by cfgs. The process involves recognizing recursive procedures in cfgs and carrying out recursive computations on a stack. The document also provides examples and instructions on how to recognize certain strings using a stack.
Typology: Slides
1 / 45
This page cannot be seen from the preview
Don't miss anything!
1
2
18
By general principles, can carry out any
recursive computation on a stack. Can do it on a restricted version of an activation record stack, called a “ P ush d own (Stack) A utomaton” or PDA for short.
Q: What is the language generated by
S # | aSa | bSb?
19
A: Palindromes in {a,b,#}* containing
exactly one #-symbol.
Q: Using a stack, how can we recognize
such strings?
21
Push it
read #? (ignore stack)
read == peek? Pop Else: CRASH!
empty stack?
22
Push it
read #? (ignore stack)
read == peek? Pop Else: CRASH!
empty stack?
Input:
aaab#baa
24
Push it
read #? (ignore stack)
read == peek? Pop Else: CRASH!
empty stack?
a a
Input:
aaab#baa
25
Push it
read #? (ignore stack)
read == peek? Pop Else: CRASH!
empty stack?
a a a
Input:
aaab#baa
27
Push it
read #? (ignore stack)
read == peek? Pop Else: CRASH!
empty stack?
b a a a
Input:
aaab#baa
28
Push it
read #? (ignore stack)
read == peek? Pop Else: CRASH!
empty stack?
a a a
Input:
aaab#baa
30
Push it
read #? (ignore stack)
read == peek? Pop Else: CRASH!
empty stack?
a
Input:
aaab#baa REJECT (nonempty stack)
31
Push it
read #? (ignore stack)
read == peek? Pop Else: CRASH!
empty stack?
a a
Input:
aaab#baaa
33
Push it
read #? (ignore stack)
read == peek? Pop Else: CRASH!
empty stack?
Input:
aaab#baaa Pause input
34
Push it
read #? (ignore stack)
read == peek? Pop Else: CRASH!
empty stack?
Input:
aaab#baaa ACCEPT