P. 1
SOLU11

SOLU11

|Views: 89|Likes:
Published by Haboosh Mohammad

More info:

Published by: Haboosh Mohammad on May 09, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/09/2012

pdf

text

original

Solutions for Assignment #11

Assignment Information

dbcd9c88decd988Sa`&Y4I1CU b7 cb B § X2G 9W S¡ 8&&VU STI82¨QCP CIHGF¥E$1¨DC¨A@ RGG '£ B A '0 © 'B 9 ! 5  § 0 !8786423&1)" ¨(&%$#" '¡ © ! ¡ § © ¥£¡  ¦¨§¦¤¢ 
5.4.3 S T aS | aTbS | aTbT | 5.4.5 a) Show that this grammar is unambiguous. This grammar is unambiguous because of following reasons. S A1B S is replaced by A1B. “1” is between A and B, so “1” divides S into A and B. S has only one production. A 0A | A is replaced by 0A or . “A 0A” | ”does not make this grammar ambiguous. (= unambiguous) As shown following tree, this A 0A replaces A to 0A. The structure of this tree is unique and expands to the right side. Left child must have 0 and right child must have A or

gggg

f

f

f

f

f

A 0 0 Left child is 0 A expand A 0 A B 0B | 1B | B is replaced by 0B. (= produce a unique tree structure) f gggg f f . Left child must have 0 or 1 and right child must have B or B 0 Left child is either 0 or 1 B expand 1 1 B B Therefore. (= unambiguous) The structure of this tree is unique and expands to the right side. 1B or . . this grammar is unambiguous.” B 0B | 1B | ” does not make this grammar ambiguous.

4. A 0 A 0 A f f S 1 B A S 1 B 1 B 0 A 0 A 1 B A 0 .5. S A B A1B 0A | A0 | 0B | 1B | For a string w=0011. Therefore. two parse trees are produced.5 b) Find a grammar for the same language that is ambiguous. and demonstrate its ambiguity. this grammar is ambiguous.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->