edited by
212 views
5 votes
5 votes

Suppose we have a rightmost derivation which proceeds as follows:

$\begin{array}{ccc}S &\rightarrow & Aabw\\ & \rightarrow &ABw \end{array}$

Which of the following is a possible handle for it?

  1. $\begin{array}{ccc} A &\rightarrow & ab \end{array}$
  2. $\begin{array}{ccc} A &\rightarrow & a\end{array}$
  3. $\begin{array}{ccc} S &\rightarrow & A\end{array}$
  4. $\begin{array}{ccc} B &\rightarrow & ab \end{array}$
edited by

1 Answer

Best answer
3 votes
3 votes
In the rightmost derivation in reverse, $B$ is being replaced by $ab$ or $"ab"$ is reduced using the production $B \to ab.$ So, $B \to ab$ is the handle.
selected by
Answer:

Related questions

4 votes
4 votes
1 answer
1
gatecse asked Dec 14, 2020
166 views
When we merge states in an $LR(1)$ parser to form an $LALR(1)$ parser, we may introduceshift-reduce conflictreduce-reduce conflictneither shift-reduce nor reduce-reduce c...