hw4soln - > x B> x B A> x A A> x x A> x x 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: -> ( x , ( B ) )-> ( x , ( B , A ) )-> ( x , ( A , A ) )-> ( x , ( x , A ) )-> ( x , ( x , x ) ) Right-most A -> ( B )-> ( B , A )-> ( B , ( B ) )-> ( B , ( B , A ) )-> ( B , ( B , x ) )-> ( B , ( A , x ) )-> ( B , ( x , x ) )-> ( A , ( x , x ) )-> ( x , ( x , x ) )...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online