1). Using the grammar in Example 3.4, show a parse tree and a leftmost derivatio
ID: 3890966 • Letter: 1
Question
1). Using the grammar in Example 3.4, show a parse tree and a leftmost derivation for each of the following statements. (a and d) a) A (A + B) * C d) A B* C* (A B)) 2). Consider the following grammar: a Which of the following sentences are in the language generated by this grammar? a. abcd acccbd C. acccbcc d. acd 4) (a) Explain what an ambiguous grammar is (b) Explain why even if a grammar is NOT ambiguous it could still be defined to not work the way the designer may wish in terms of operator precedenceExplanation / Answer
[2] [D]
<S> -> <A>a<B>b
= bb a a b
= bbaab
[3] [B]
<S> -> a<S>c<B>|<A>|bb
= acccbd
[4a] According to Context Free Grammars a ambiguous if there exists more than one derivation tree for the given input string.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.