The Overall Procedure I Given P = ( Q , Σ , Γ , δ, q 0 , { q accept } ) Construct a CFG G var( G ) = { A pq | p , q ∈ Q } Start variable: A q 0 , q accept Rules: see earlier slides October 15, 2020 1 / 7
Needed modifications of PDA I Recall we need PDA to satisfy Single accept state 1 Stack empty before accepting 2 Each transition push or pop, but not both 3 Let’s handle the first two together: single accept and stack empty before accepting: A new start q s → q s ′ with ǫ, ǫ → $ For any q ∈ F , we have ǫ, a → ǫ back to q , ∀ a . This pops things out before accepting a string Then from any q ∈ F , we do ǫ, $ → ǫ to q a . October 15, 2020 2 / 7
Needed modifications of PDA II q ∈ F are no longer accept states See the illustration in the following figures Original PDA: q 1 q s ′ · · · q 2 October 15, 2020 3 / 7
Needed modifications of PDA III New: ǫ, a → ǫ ǫ, b → ǫ q 1 ǫ, $ → ǫ ǫ, ǫ → $ q s q s ′ q a · · · q 2 ǫ, $ → ǫ ǫ, a → ǫ ǫ, b → ǫ October 15, 2020 4 / 7
Needed modifications of PDA IV To have each transition push or pop, but not both, change q 1 → q 2 with a , a → b to q 1 → q 3 , a , a → ǫ q 3 → q 2 , ǫ, ǫ → b and change q 1 → q 2 , a , ǫ → ǫ to q 1 → q 3 , a , ǫ → ? q 3 → q 2 , ǫ, ? → ǫ October 15, 2020 5 / 7
Regular language is context Free I We roughly know this but didn’t give a formal proof. Here are the steps Regular language ⇒ recognized by DFA (in Chapter 1) DFA is a PDA Thus regular language recognized by PDA Then any regular language is context free (by the proof in this chapter) October 15, 2020 6 / 7
Non-context free languages I There are such languages We omit the discussion October 15, 2020 7 / 7
Recommend
More recommend