{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

notes21 Pushdown Automata and CFGs - CS 373 Theory of...

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

View Full Document Right Arrow Icon
CS 373: Theory of Computation Gul Agha Mahesh Viswanathan Fall 2010 1
Background image of page 1

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

View Full Document Right Arrow Icon
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 { 0 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
Background image of page 2
1.2 Definition Pushdown Automata (PDA) a b
Background image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}