$LR(k)$ grammar and handles

35 Views Asked by At

I would like to understand in the snippet below why $\gamma\to aa$ has both handles $(A\to a,1)$ and $(A\to a,2)$. The definition of a handle is on the top of the snippet.

enter image description here

1

There are 1 best solutions below

3
On BEST ANSWER

$S\Rightarrow_R^* Aa$ (trivially, because $S\to Aa$). So $A\to a$ is a handle of $aa$ at position 1.

But also, $S\Rightarrow_R^* aA$ (again trivially, because $S\to aA$). So $A\to a$ is a handle of $aa$ at position 2.