PDA_Accept_Context_Free

# PDA_Accept_Context_Free - PDAs Accept Context-Free...

This preview shows pages 1–15. 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 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 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: PDAs Accept Context-Free Languages Context-Free Languages (Grammars) Languages Accepted by PDAs = Theorem: Context-Free Languages (Grammars) Languages Accepted by PDAs Proof - Step 1: Convert any context-free grammar to a PDA with: G M ) ( ) ( M L G L = Context-Free Languages (Grammars) Languages Accepted by PDAs Proof - Step 2: Convert any PDA to a context-free grammar with: G M ) ( ) ( M L G L = Convert Context-Free Grammars to PDAs Proof - step 1 M We will convert to a PDA such that: G Take an arbitrary context-free grammar G ) ( ) ( M L G L = q q 1 2 q S , , \$ \$ w A , a a , production in w A terminal in a G G Conversion Procedure: For each For each Add transitions q q 1 2 q S , , \$ \$ Grammar PDA T Ta T b S aSTb S , , , , T Ta T b S aSTb S b b a a , , Example n k k m k X X S 1 1 1 1 + ,\$) , ( \$) , , ( \$) , , ( ,\$) , ( 2 1 1 1 1 1 1 1 1 q X X q S q q m n k n k k n k k + + + PDA simulates leftmost derivations Grammar Leftmost Derivation PDA Computation Scanned symbols Stack contents Bzy x xAy j i Grammar Leftmost Derivation Bz A j i Production applied Terminals Leftmost variable Variables or terminals Terminals Variable Variables or terminals Bzy x xAy j i \$) , , ( \$) , , ( 1 1 Bzy q Ay q j i n i n i Grammar Leftmost Derivation PDA Computation Bz A j i Production applied q q 1 2 q S , , \$ \$ Bz A j i , Transition applied Bzy x xAy j i \$) , , ( \$) , , ( \$) , , ( 1 1 1 1 1 Bzy q Bzy q Ay q j i n i j i n i n i + + Grammar Leftmost Derivation PDA Computation q q 1 2 q S , , \$ \$ i i , Transition applied Read from input and remove it from stack i Bzy x xAy j i \$) , , ( \$) , , ( \$) , , ( \$) , , ( 1 1 1 1 1 1 1 Bzy q Bzy q Bzy q Ay q n j j i n i j i n i n i + + + Grammar Leftmost Derivation PDA Computation q q 1 2 q S , , \$ \$ j j , Last Transition applied All symbols have been removed from top of stack j i Cpzy x Bzy x xAy k j j i j i 1 + \$) , , ( \$) , , ( \$) , , ( 1 1...
View Full Document

## This note was uploaded on 12/02/2011 for the course AR 107 taught by Professor Gracegraham during the Fall '11 term at Montgomery College.

### Page1 / 69

PDA_Accept_Context_Free - PDAs Accept Context-Free...

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

View Full Document
Ask a homework question - tutors are online