
Pushdown Automata Semantics of a PDA CS 373: Theory of Computation Gul Agha Mahesh Viswanathan University of Illinois, Urbana-Champaign Fall 2010 Agha-Viswanathan CS373 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 Computing Using a Stack Pushdown Automata Definition Semantics of a PDA Examples of Pushdown Automata Restricted Infinite Memory: The Stack Agha-Viswanathan CS373 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 Computing Using a Stack Pushdown Automata Definition Semantics of a PDA Examples of Pushdown Automata Restricted Infinite Memory: The Stack So far we considered automata with finite memory or machines with infinite memory Agha-Viswanathan CS373 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 Computing Using a Stack Pushdown Automata Definition Semantics of a PDA Examples of Pushdown Automata 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 Agha-Viswanathan CS373 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 Computing Using a Stack Pushdown Automata Definition Semantics of a PDA Examples of Pushdown Automata 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. Agha-Viswanathan CS373 can add to only the top of the stack: push On longer inputs, automaton may have more items in the stack Computing Using a Stack Pushdown Automata Definition Semantics of a PDA Examples of Pushdown Automata 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 Agha-Viswanathan CS373 On longer inputs, automaton may have more items in the stack Computing Using a Stack Pushdown Automata Definition Semantics of a PDA Examples of Pushdown Automata 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 Agha-Viswanathan CS373 Computing Using a Stack Pushdown Automata Definition Semantics of a PDA Examples of Pushdown Automata 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 Agha-Viswanathan CS373 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 Computing Using a Stack Pushdown Automata Definition Semantics of a PDA Examples of Pushdown Automata Keeping Count Using the Stack An automaton can use the stack to recognize f0n1ng Agha-Viswanathan CS373 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 Computing Using a Stack Pushdown Automata Definition Semantics of a PDA Examples of Pushdown Automata Keeping Count Using the Stack An automaton can use the stack to recognize f0n1ng On reading a 0, push it onto the stack Agha-Viswanathan CS373 (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 Computing Using a Stack Pushdown Automata Definition Semantics of a PDA Examples of Pushdown Automata Keeping Count Using the Stack An automaton can use the stack to recognize f0n1ng On reading a 0, push it onto the stack After the 0s, on reading each 1, pop a 0 Agha-Viswanathan CS373 If attempt to pop an empty stack, reject If stack not empty at the end, reject Else accept Computing Using a Stack Pushdown Automata Definition Semantics of a PDA Examples of Pushdown Automata Keeping Count Using the Stack An automaton can use the stack to recognize f0n1ng 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) Agha-Viswanathan CS373 If stack not empty at the end, reject Else accept Computing Using a Stack Pushdown Automata Definition Semantics of a PDA Examples of Pushdown Automata Keeping Count Using the Stack An automaton can use the stack to recognize f0n1ng 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 Agha-Viswanathan CS373 Else accept Computing Using a Stack Pushdown Automata Definition Semantics of a PDA Examples of Pushdown Automata Keeping Count Using the Stack An automaton can use the stack to recognize f0n1ng 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 Agha-Viswanathan CS373 Computing Using a Stack Pushdown Automata Definition Semantics of a PDA Examples of Pushdown Automata Keeping Count Using the Stack An automaton can use the stack to recognize f0n1ng 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 Agha-Viswanathan CS373 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 e.g. (())() is balanced, but ())() and (() are not Computing Using a Stack Pushdown Automata Definition Semantics of a PDA Examples of Pushdown Automata Matching Parenthesis Using the Stack An automaton can use the stack to recognize balanced parenthesis Agha-Viswanathan CS373 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 Computing Using a Stack Pushdown Automata Definition Semantics of a PDA Examples of Pushdown Automata Matching Parenthesis Using the Stack An automaton can use the stack to recognize balanced parenthesis e.g. (())() is balanced, but ())() and (() are not Agha-Viswanathan CS373 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 Computing Using a Stack Pushdown Automata Definition Semantics of a PDA Examples of Pushdown Automata 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 Agha-Viswanathan CS373 If attempt to pop an empty stack, reject If stack not empty at the end, reject Else accept Computing Using a Stack Pushdown Automata Definition Semantics of a PDA Examples of Pushdown Automata 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 Agha-Viswanathan CS373 If stack not empty at the end, reject Else accept Computing Using a Stack Pushdown Automata Definition Semantics of a PDA Examples of Pushdown Automata 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 Agha-Viswanathan CS373 Else accept Computing Using a Stack Pushdown Automata Definition Semantics of a PDA Examples of Pushdown Automata Matching Parenthesis Using the Stack An automaton can use the stack to recognize balanced parenthesis e.g.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages80 Page
-
File Size-