hw4a - Copy (2)

# hw4a - Copy (2) - DT Explain your answer The tree with...

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

MCS4653, Theory of Computation Homework Assignment 4, Due 10/6/03 Sample Answers Page 1 1. (Sudkamp 3.3 page 82-3) Let G be the grammar S SAB | λ A aA | a B bB | λ a) Give a leftmost derivation of abbaab . S SAB SABAB ABAB aBAB abBAB abbAB abbaAB abbaaB abbaab b) Give two leftmost derivations of aa . S SAB AB aAB aaB aa and S SAB SABAB ABAB aBAB aAB aaB aa c) Build the derivation tree for the derivations in part(b). λ S a a A A λ B S λ S a A λ B S a A λ B S d) Give a regular expression for L ( G ). ( a + b * ) * 2. (Sudkamp 3.4 page 83) Let DT be the derivation tree a a A A a A b B B S a) Give a leftmost derivation that generates the tree DT . S AB aAB aaAB aaAB aaaB aaab b) Give a rightmost derivation that generates the tree DT . S AB AAB AAb AaAb Aaab aaab c) How many diﬀerent derivations are there that generate
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: DT ? Explain your answer. The tree with subscripts on the variables and a listing of the possible sequences of variable substitutions a a A 2 A 1 a A 3 b B 2 B 1 S A 1 ,A 2 ,B 1 ,A 3 ,B 2 A 1 ,A 2 ,B 1 ,B 2 ,A 3 A 1 ,B 1 ,A 2 ,A 3 ,B 2 A 1 ,B 1 ,A 2 ,B 2 ,A 3 A 1 ,B 1 ,A 3 ,A 2 ,B 2 A 1 ,B 1 ,A 3 ,B 2 ,A 2 A 1 ,B 1 ,B 2 ,A 3 ,A 2 A 1 ,B 1 ,B 2 ,A 2 ,A 3 B 1 ,A 1 ,A 2 ,A 3 ,B 2 B 1 ,A 1 ,A 2 ,B 2 ,A 3 B 1 ,A 1 ,A 3 ,A 2 ,B 2 B 1 ,A 1 ,A 3 ,B 2 ,A 2 B 1 ,A 1 ,B 2 ,A 3 ,A 2 B 1 ,A 1 ,B 2 ,A 2 ,A 3 B 1 ,A 3 ,B 2 ,A 1 ,A 2 B 1 ,B 2 ,A 3 ,A 1 ,A 2 B 1 ,A 3 ,A 1 ,A 2 ,B 2 B 1 ,A 3 ,A 1 ,B 2 ,A 2 B 1 ,B 2 ,A 1 ,A 2 ,A 3 B 1 ,B 2 ,A 1 ,A 3 ,A 2...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online