This preview shows pages 1–4. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS 373: Theory of Computation Gul Agha Mahesh Viswanathan Fall 2010 1 1 Pushdown Automata 1.1 Computing Using a Stack Restricted Infinite Memory: The Stack • So far we considered automata with finite memory or machines with infinite memory • Today: automata with access to an infinite stack — infinite memory but restricted access • The stack can contain an unlimited number of characters. But – can read/erase only the top of the stack: pop – can add to only the top of the stack: push • On longer inputs, automaton may have more items in the stack Keeping Count Using the Stack • An automaton can use the stack to recognize { n 1 n } – On reading a 0, push it onto the stack – After the 0s, on reading each 1, pop a 0 – (If a 0 comes after a 1, reject) – If attempt to pop an empty stack, reject – If stack not empty at the end, reject – Else accept Matching Parenthesis Using the Stack • An automaton can use the stack to recognize balanced parenthesis • e.g. (())() is balanced, but ())() and (() are not – On seeing a ( push it on the stack – On seeing a ) pop a ( from the stack – If attempt to pop an empty stack, reject – If stack not empty at the end, reject – Else accept 2 1.2 Definition Pushdown Automata (PDA) a b...
View
Full
Document
This note was uploaded on 10/04/2011 for the course CS 373 taught by Professor Viswanathan,m during the Fall '08 term at University of Illinois, Urbana Champaign.
 Fall '08
 Viswanathan,M

Click to edit the document details