CFG => PDA Sipser 2 (pages )
CS 311 Fall 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 × Γ ε ) is the transition function – q 0 ∈ Q is the initial state, and – F ⊆ Q is the set of accept states
CS 311 Fall Balanced brackets Let M = (Q, Σ, Γ, δ, q 0, F), where – Q = {q 1, q 2, q 3 } – Σ = {[, ]} – Γ = {[, $} – q 0 = q 1 – F = {q 1, q 3 } – δ is given by the transition diagram:
CS 311 Fall Finite automata and Pushdown automata ? ? Pushdown languages Regular languages
CS 311 Fall Regular => Pushdown Proposition: Every finite automaton can be viewed as a pushdown automaton that never operates on its stack. Proof: Let M = (Q, Σ, δ, q 0, F) be a finite automaton. Define M' = (Q, Σ, Γ, δ', q 0, F), where…
CS 311 Fall Finite automata and Pushdown automata ? ? Pushdown languages Regular languages
CS 311 Fall Pushdown automata are nondeterministic Build a machine to recognize PAL = {ww R | w ∈ {0, 1}*} Finite control $ $ stack or pushdown store reading head 1 1
CS 311 Fall Recognizing context-free languages Lemma 2.21: If a language is context-free, then some pushdown automaton recognizes it. Proof:
CS 311 Fall Shorthand for…
CS 311 Fall For example… Let’s use this construction on: G = (V, Σ, R, S), where V = {S} Σ = {[, ]} R = { S → G ε, S → G SS, S → G [S]}