hw4soln - -> ( x , ( B ) )-> ( x , (...

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

View Full Document Right Arrow Icon
HW 4 Sample Solution Problem 1 The following pseudo-string case <arith_expr> :: case <arith_expr> :: default <stmt> produces to parse trees. By definition the grammar is ambiguous. Problem 2 A ( B ) B , A A x x x A ( B ) B , A A x B B , A A x 2.3 A ::= ( B ) | x B ::= A B' B' ::= , A B' | epsilon 2.2 Left-most A -> ( B ) -> ( B , A ) -> ( A , A ) -> ( x , A )
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: -&gt; ( x , ( B ) )-&gt; ( x , ( B , A ) )-&gt; ( x , ( A , A ) )-&gt; ( x , ( x , A ) )-&gt; ( x , ( x , x ) ) Right-most A -&gt; ( B )-&gt; ( B , A )-&gt; ( B , ( B ) )-&gt; ( B , ( B , A ) )-&gt; ( B , ( B , x ) )-&gt; ( B , ( A , x ) )-&gt; ( B , ( x , x ) )-&gt; ( A , ( x , x ) )-&gt; ( x , ( x , x ) )...
View Full Document

Ask a homework question - tutors are online