pushdown accepters context free grammars
Download
Skip this Video
Download Presentation
Pushdown Accepters & Context-Free Grammars

Loading in 2 Seconds...

play fullscreen
1 / 8

Pushdown Accepters & Context-Free Grammars - PowerPoint PPT Presentation


  • 113 Views
  • Uploaded on

Pushdown Accepters & Context-Free Grammars. Sipser, Theorem 2.12 Denning, Chapter 8. Fundamental theorem of CFLs and PDAs. Theorem 2.12 (Sipser) A language L is context-free if and only if (iff) there exists a pushdown accepter M that recognizes L. CFL if PDA; PDA -> CFL.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Pushdown Accepters & Context-Free Grammars' - harding-fry


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
pushdown accepters context free grammars

Pushdown Accepters & Context-Free Grammars

Sipser, Theorem 2.12

Denning, Chapter 8

fundamental theorem of cfls and pdas
Fundamental theorem of CFLs and PDAs
  • Theorem 2.12 (Sipser) A language L is context-free if and only if (iff) there exists a pushdown accepter M that recognizes L
cfl if pda pda cfl
CFL if PDA; PDA -> CFL
  • Given a PDA, M, that recognizes language L, then there exists a CFG, G, that generates language L.
  • Proof: Denning, Section 8.4, using traverse sets
cfl only if pda cfl pda
CFL only if PDA; CFL -> PDA
  • Given a CFL, L, generated by grammar G, we can build a PDA, M, which recognizes language L.
  • Proof: Denning, Section 8.3
proof cfl pda
Proof: CFL -> PDA
  • Since L is context free, there is a context free grammar, G = (N,T,P,S) that generates L.
  • Construct the PDA, M=(Q,T,U,P’,q0,{q3}), as follows:
    • T = same input alphabet
    • U = N  T  {S} = stack alphabet
    • Q = {q0,q1,q2,q3}  {qx | x  U}
program of m
Program of M
  • q0: , push($), goto q1q1: , push(S), goto q2q2: , pop($), goto q3
  • For each production A->wq2: , pop(A), goto qAqA: , push(wR), goto q2
  • For each terminal symbol aq2: a, NOP, goto qaqa: , pop(a), goto q2
example l 0 k 1 k k 0
Example: L = {0k1k | k  0}
  • Grammar G has productions:SA; A01; A0A1

push 1

push A

push 0

pop A

push A

push 0

pop S

push S

push $

pop $

pop 0

in 1

pop 1

in 0

ex 2 l 0 j 1 k 2 j k j k 0
Ex 2: L={0j1k2j+k| j,k > 0}
  • SA; A0A2; A0B2; B12; B1B2
ad