COMPUTER SCIENCE TRIPOS Part IB – 2020 – Paper 4
Compiler Construction (tgg22)
Consider the following Context Free Grammar
S → Aa | BAb
A → BB | c
B → Sd | e
where {a, b, c, d, e} is the set of terminal symbols.
(a) Give a right-most derivation of ecadeb. [1 mark]
(b) Give a left-most derivation of ecadeb. [1 mark]
(c) Compute FIRST and FOLLOW for this grammar. Show your work. [6 marks]
(d) Is the grammar LL(1)? Justify your answer. [4 marks]
(e) Is the grammar SLR(1)? Justify your answer. [8 marks]