lect12-pda2

# lect12-pda2 - 1 Equivalence of PDA, CFG Conversion of CFG...

This preview shows pages 1–7. Sign up to view the full content.

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

View Full Document

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

View Full Document

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 Equivalence of PDA, CFG Conversion of CFG to PDA Conversion of PDA to CFG 2 Overview ◆ When we talked about closure properties of regular languages, it was useful to be able to jump between RE and DFA representations. ◆ Similarly, CFG’s and PDA’s are both useful to deal with properties of the CFL’s. 3 Overview – (2) ◆ Also, PDA’s, being “algorithmic,” are often easier to use when arguing that a language is a CFL. ◆ Example : It is easy to see how a PDA can recognize balanced parentheses; not so easy as a grammar. ◆ But all depends on knowing that CFG’s and PDA’s both define the CFL’s. 4 Converting a CFG to a PDA ◆ Let L = L(G). ◆ Construct PDA P such that N(P) = L. ◆ P has: ◗ One state q. ◗ Input symbols = terminals of G. ◗ Stack symbols = all symbols of G. ◗ Start symbol = start symbol of G. 5 Intuition About P ◆ Given input w, P will step through a leftmost derivation of w from the start symbol S. ◆ Since P can’t know what this derivation is, or even what the end of w is, it uses nondeterminism to “guess” the production to use at each step. 6 Intuition – (2) ◆ At each step, P represents some left-sentential form (step of a leftmost derivation). ◆ If the stack of P is α , and P has so far consumed x from its input, then P represents left-sentential form x α ....
View Full Document

## This note was uploaded on 03/30/2012 for the course CS 154 taught by Professor Motwani,r during the Spring '08 term at Stanford.

### Page1 / 22

lect12-pda2 - 1 Equivalence of PDA, CFG Conversion of CFG...

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

View Full Document
Ask a homework question - tutors are online