# Tutorial II

## The questions

(Taken from Kari’s homework 5 questions 4 and 5.)

*hw5(4)*Consider the grammar G = ({S, A, B}, {a, b}, P, S) with productions

S ::= SAB | ε

A ::= aA | ε

B ::= Bb | ε

a) Give a leftmost derivation for aababba.

b) Draw the derivation tree corresponding to the derivation in a).*hw5(5)*Are the following grammars ambiguous or unambiguous? Prove it.

a) G = ({S}, {a, b}, P, S) with productions S ::= aSa | aSbSa | ε.

b) G = ({S}, {a, b}, P, S) with productions S ::= aaSb | abSbS | ε.