# assgn1 - q 1 , ) } ( q , a, a ) = { ( q , aa ) } ( q 1 , b,...

This preview shows page 1. Sign up to view the full content.

Theory of Algorithms. Spring 2000. Homework Assignment 8. Section 7.2 The Equivalence of NPDAs and Context-Free Grammars. (1) Let G be the following context-free grammar, with V = { S, B, C } , T = { a, b, c } . S aSbbB | C | λ B b | λ C Cc | c (a) Find an npda M such that L ( M )= L ( G ). (b) Give a left-most derivation from G of the string: aaccbbbbb . (c) Give the corresponding sequence of instantaneous descriptions for M . (2) Let M be the following npda, with Γ = { S, 0 , 1 ,z } , F = { q f } . δ ( q 0 ,λ,z )= { ( q 1 ,Sz ) } δ ( q 1 ,a,S )= { ( q 1 , 11 s ) } δ ( q 1 ,a, 1) = { ( q 1 , 11) } δ ( q 1 ,a, 0) = { ( q 1 ) , ( q 1 , 010) } δ ( q 1 ,b, 1) = { ( q 1 ) } δ ( q 1 ,b,S )= { ( q 1 ) , ( q 1 , 0 S ) } δ ( q 1 ,λ, 0) = { ( q 1 , 000) , ( q 1 ) } δ ( q 1 ,λ,z )= { ( q f ) } Find a context-free grammar G such that L ( G )= L ( M ). (3) (OPTIONAL) Let M 0 be the following npda, with Q 0 = { q 0 0 ,q 0 1 ,q 0 2 } , F 0 = { q 0 1 ,q 0 2 } 0 = { a, b } ,andΓ 0 = { z 0 ,a,b } . δ 0 ( q 0 0 ,a,z 0 )= { ( q 0 0 ,az 0 ) , ( q 0 2 ) } δ 0 ( q 0 0 ,a,a )= { ( q 0 0 ,aa ) , ( q 0 1 ) } δ 0 ( q 0 0 ,b,a )= { ( q 0 0 ,ba ) } δ 0 ( q 0 1 ,b,b )= { ( q 0 1 ) } δ 0 ( q 0 1 ,a,a )= { ( q 0 1 ) } δ 0 ( q 0 2 ,a,a )= { ( q 0 2 ,a ) } Find an npda M such that L ( M )= L ( M 0 )and M is in pre-standard form. (4) Let M be the following npda with F = { q f } . δ ( q 0 ,a,z )= { ( q 0 ,az ) } δ ( q 1 ,a,a )= { (
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: q 1 , ) } ( q , a, a ) = { ( q , aa ) } ( q 1 , b, b ) = { ( q 1 , ) } ( q , a, b ) = { ( q , ab ) } ( q 1 , , z ) = { ( q f , ) } ( q , b, z ) = { ( q , bz ) } ( q , b, a ) = { ( q , ba ) } ( q , , a ) = { ( q 1 , a ) } ( q , b, b ) = { ( q , bb ) } ( q , , b ) = { ( q 1 , b ) } (a) Find an npda M such that L ( M ) = L ( M ), and M is in standard reduced form. Use the clause-template notation that I used in the example in the notes. (b) Give the sequences of instantaneous descriptions for M and M that show that M and M accept the string: abaaba . 1...
View Full Document

Ask a homework question - tutors are online