Parsing & Syntax Analysis

Answer & solution
Official answer: C
A conflict-free SLR(1) table yields a unique parse, so every SLR(1) grammar is unambiguous. The converse fails: the standard grammar S→L=R|R, L→*R|id, R→L is unambiguous but has an SLR shift-reduce conflict. General CFG recognition and construction of a parse can be done in O(n³) for a fixed grammar, for example by Earley parsing or CYK after normalization. Thus both statements hold, C; this does not claim that exponentially many parse trees can all be listed in cubic time.
In the counterexample grammar, the LR(0) state after recognizing L contains S→L·=R and R→L·. Since '=' belongs to FOLLOW(R), SLR would both shift '=' and reduce R→L there. Thus unambiguity alone does not remove SLR conflicts. For cubic parsing, CYK stores whether each nonterminal derives each substring and considers O(n) split points for O(n²) substrings; the fixed grammar contributes only a constant factor. A parse witness can be recovered by stored backpointers.