100 likes | 243 Views
CFG => PDA. Sipser 2 (pages 99 - 118). Formally…. A pushdown automaton is a sextuple M = (Q, Σ , Γ , δ , q 0 , F) , where Q is a finite set of states Σ is a finite alphabet (the input symbols) Γ is a finite alphabet (the stack symbols) δ : (Q × Σ ε × Γ ε ) → P(Q × Γ ε )
E N D
CFG => PDA Sipser 2 (pages 99-118)
Formally… • A pushdown automaton is a sextuple M = (Q, Σ, Γ, δ, q0, F), where • Q is a finite set of states • Σ is a finite alphabet (the input symbols) • Γ is a finite alphabet (the stack symbols) • δ: (Q × Σε ×Γε) → P(Q × Γε) is the transition function • q0∈Q is the initial state, and • F⊆Q is the set of accept states
Balanced brackets • Let M = (Q, Σ, Γ, δ, q0, F), where • Q = {q1, q2, q3} • Σ = {[, ]} • Γ = {[, $} • q0 = q1 • F = {q1, q3} • δ is given by the transition diagram:
Finite automata and Pushdown automata ? Pushdown languages Regular languages
Regular => Pushdown • Proposition: Every finite automaton can be viewed as a pushdown automaton that never operates on its stack. • Proof: Let M = (Q, Σ, δ, q0, F) be a finite automaton. Define M' = (Q, Σ, Γ, δ', q0, F), where…
Finite automata and Pushdown automata ? Pushdown languages Regular languages
Pushdown automata are nondeterministic • Build a machine to recognize PAL = {wwR| w∈{0, 1}*} 0 1 0 1 1 0 1 0 1 reading head 0 stack or pushdown store 1 Finite control 0 $
Recognizing context-free languages • Lemma 2.21: If a language is context-free, then some pushdown automaton recognizes it. • Proof:
For example… • Let’s use this construction on: • G = (V, Σ, R, S), where V = {S} Σ = {[, ]} R = { S →Gε, S →G SS, S →G [S]}