20.06.2014 Views

Ambiguous Grammars - ByteLABS

Ambiguous Grammars - ByteLABS

Ambiguous Grammars - ByteLABS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Ambiguity<br />

if Expr 1 then if Expr 2 then Stmt 1 else Stmt 2<br />

Rule Sentential Form<br />

— Stmt<br />

1 if Expr then Stmt<br />

2 if Expr then if Expr then WithElse else Stmt<br />

3 if Expr then if Expr then WithElse else S 2<br />

5 if Expr then if Expr then S 1 else S 2<br />

? if Expr then if E 2 then S 1 else S 2<br />

? if E 1 then if E 2 then S 1 else S 2<br />

some other production<br />

This grammar has only one rightmost derivation for the example<br />

COMP 412, Fall 2002 19<br />

Comp 412 Fall 2005

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!