1 / 11

CSCI 3130: Automata theory and formal languages

Fall 2010. The Chinese University of Hong Kong. CSCI 3130: Automata theory and formal languages. Pushdown automata. Andrej Bogdanov http://www.cse.cuhk.edu.hk/~andrejb/csc3130. Motivation. regular expression. NFA. DFA. syntactic. computational. is more powerful than. CFG.

leona
Download Presentation

CSCI 3130: Automata theory and formal languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Fall 2010 The Chinese University of Hong Kong CSCI 3130: Automata theory and formal languages Pushdown automata Andrej Bogdanov http://www.cse.cuhk.edu.hk/~andrejb/csc3130

  2. Motivation regularexpression NFA DFA syntactic computational is more powerful than CFG pushdown automaton syntactic computational

  3. Pushdown automata versus NFA state control input 0 1 0 0 NFA

  4. Pushdown automata state control input 0 1 0 0 … stack pushdown automaton (PDA) A PDA is like an NFA with but with an infinite stack

  5. Pushdown automata state control input 0 1 0 0 … $ 0 1 1 stack pushdown automaton (PDA) As the PDA is reading the input, it can push / pop symbols from the top of the stack

  6. Building a PDA state control L = {0n1n: n ≥ 1} push $ We remember each 0 by pushingx onto the stack read 0 push x read 1 When we see a 1, we pop an x from the stack pop x read 1 pop x We want to accept when we hit the stack bottom pop $ $=special marker for bottom

  7. A PDA in action state control L = {0n1n: n ≥ 1} push $ input read 0 0 0 0 1 1 1 push x read 1 pop x … $ x x x read 1 stack pop x pop $

  8. Notation for PDAs q0 e, e / $ push $ q1 0, e / x read 0 push x 1, x / e read 1 pop x q2 1, x / e read 1 pop x e, $ / e pop $ q3 read, pop / push

  9. Definition of a PDA A pushdown automaton is (Q, ,, , q0, F) where: • Q is a finite set of states; •  is the input alphabet; •  is the stack alphabet • q0in Q is the initial state; • F  Q is a set of final states; •  is the transition function d: Q  (  {})  (  {}) → subsets of Q  (G  {}) pop symbol state input symbol state push symbol

  10. Example q0 S = {0, 1} e, e / $ G = {$, x} q1 0, e / x d(q0, e, e) = {(q1, $)} 1, x / e d(q0, e, $) = ∅ d(q0, e, x) = ∅ q2 1, x / e d(q0, 0, e) = ∅ ... e, $ / e q3 d: Q  (  {})  (  {}) → subsets of Q  (G  {}) pop symbol state input symbol state push symbol

  11. The language of a PDA • A PDA is nondeterministicMultiple transitions on same pop/input allowed • Transitions may but do not have to push or pop The language of a PDA is the set of all strings in S* that can lead the PDA to an accepting state

More Related