module6-print

module6-print - Module 6 Pushdown automata The automaton...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Module 6 Pushdown automata The automaton for context-free languages CS 360: Introduction to the Theory of Computing Daniel G. Brown, University of Waterloo 6.1 Topics for this module Pushdown automata definitions Languages of pushdown automata The equivalence of pushdown automata and context-free grammars Deterministic PDAs The theorem that relates CFLs and PDAs was discovered by a few people, but one was the famous linguist Noam Chomsky. 6.2 1 Pushdown automata Pushdown automaton We need a new machine to accept context-free languages. Our new machine is called a pushdown automaton . The basic limitation of DFA/NFAs: no ability to keep infinite memory. Important : FAs can keep a finite amount of memory: k bits can be stored by multiplying the state space by 2 k . Pushdown automata have infinite memory, but only accessed in proscribed order. Things added to the memory recently must be read before things added long in the past. This is why L = { ss | s Σ * } won’t be accepted by them: we’d have to look back very far in the memory. 6.3 From an ε -NFA to a PDA We treat the memory as a stack, and have a finite automaton controlling it. Each transition is of the form: If top letter on the memory stack is b , and next letter in the input is a (or ε , if we don’t read an input letter), and the controlling FA is in state q , then: Go to state r , take the b off the top of the memory stack, eat the letter a from the input (again, a might be ε ), and write word w onto the top of the memory stack. 6.4 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Envisioning a PDA a w Each move: Take top plate off stack, next letter in input sequence (or ε -transition). Based on current state, go to different state, (maybe) put new plates on stack. Important : PDAs are also nondeterministic. 6.5 More tweaks in how they work The stack must never be empty: There is a special “stack empty” symbol Z 0 . If Z 0 is on the top of the stack, we make sure it gets returned to bottom of stack after the next move. The string put on the stack may be empty (stack gets 1 symbol shorter), or long. It does not have to just be 0 or 1 letters long! It must be of finite length. And, again, very important: PDAs are by definition non-deterministic unless otherwise stated. (Deterministic PDAs are not as powerful as nondeterministic ones!) 6.6 Formal definitions Doesn’t seem too bad, but turns into a 7-tuple! A PDA is a 7-tuple, M = ( Q , Σ , Γ , δ , q 0 , Z 0 , F ) , where: Q = finite set of states for control Σ = finite input alphabet Γ = finite stack alphabet (often, it’s just Γ = { Z 0 }∪ Σ ) δ = transition function q 0 = start state for machine Z 0 = stack start letter (bottom of stack character) F = accepting states for finite control 6.7 What do all of these elements mean?
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 17

module6-print - Module 6 Pushdown automata The automaton...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online