New answers tagged

0

An example is the word $aabbab$. We can either create it like this $$S \rightarrow aT \rightarrow aaTT \rightarrow aabST \rightarrow aabbRT \rightarrow aabbaT \rightarrow aabbab.$$ Or like this $$S \rightarrow aT \rightarrow aaTT \rightarrow aabT \rightarrow aabbS \rightarrow aabbaT \rightarrow aabbab.$$


0

Let's start where you probably started, with the classic expression grammar: $$\begin{align}E&\to T\mid E + T\mid E - T\\ T&\to F\mid T * F\mid T / F\\ F&\to ( E )\mid x\\ \end{align}$$ and then we add the "fused" productions: $$\begin{align}E&\to E + T * F\mid E - T * F\\ \end{align}$$ That grammar has a conflict because of the ambiguity:...


Top 50 recent answers are included