1.Given a Grammar G {S}, {a, b}, S, Pwith P defined as:
S aSb,
S
(i) Obtain a sentence in language generated by G and the sentential form.
(ii) Obtain the language L(G).
2. Find regular expressions over {a, b} for the language defined as follows:
L1 = {a mbm : m 0}
L2 = {bm abn : m 0, n 0 }
L3 ={ a mbm , m 0, n 0 }
3. Draw derivation or parse trees for G=({a, b}, {S,A}, S, P), where P is:
S → aAS
S → a
A → SbA
A → ba
4. Draw:
Syntax tree for 9-5+2
Transition diagram that recognised identifier and key words and
Translate the assignment statement
A : = -B*(C+D) into three-address code.
5. (a) Consider the grammar G3,construct the LL(1) parsing table for this grammar.
Grammar G3 :
S aBa
B bB / ᶓ
(b) Show that Grammar G2 is left-recursive.
Grammar G2 :
S S(S)
S ᶓ