New answers tagged

1

Here's one pattern for an LR(k) grammar which is not LR(k-1). I didn't fill in the definition of $A$; there's nothing particularly special about it. It might have an empty right-hand side, or it might match any LR(k) subgrammar. $a^k$ represents $k$ instances of $a$. $$ \begin{align}S&\to B a^{k-1} b\\ S&\to C a^{k-1} c\\ B&\to A\\ C&\to A\\ ...


2

You haven't actually augmented the grammar. The augmented grammar has the production $$start\to SL\;\$$$ With that change, state 1 is not a reduction state and there is no conflict. If you did not intend to augment the grammar, then it is not $LR(0)$, because the language does not have the prefix property. But that's not very useful, so normally we augment ...


Top 50 recent answers are included