# Precedence Table Construction Algorithm for CFGs Regardless of Being OPGs
## 6 Exceptions  
If the CFG has any of the following forms, the rules outlined in the algorithms of this paper would not apply:  
1. \(A\longrightarrow aBb\) \(B\longrightarrow\beta a\) The sets for \(B\) in the second production are: \(\mathcal{L}(B)=\{a\}\). \(\mathcal{R}(B)=\{a\}\). The precedence relations based on the sections of Algorithm 5 exhibit:  
* For the rule (C): \(a\leqslant a\) and \(u=a\).
* For the rule (D.1): \(a\geqslant b\).
* For the rule (D.2): \(a\doteq b\).  
Applying rules (D.1) and (D.2) generates the conflict.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Stack** & **Input** & **Action** \\ \hline \(\$\) & \(aabbcd\$\) & Shift \\ \hline \(\$\) & \(abbcd\$\) & Shift \\ \hline \(\$\) & \(abbcd\$\) & Shift \\ \hline \(\$\) & \(bbcd\$\) & Reduce \\ \hline \(\$\) & \(bbcd\$\) & Reduce \\ \hline \(\$\) & \(bbcd\$\) & Shift \\ \hline \(\$\) & \(bbcd\$\) & Shift \\ \hline \(\$\) & \(bbcd\$\) & Shift \\ \hline \hline \end{tabular}
\end{table}
Table 17: Bottom-up Parsing of Example 3.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Stack** & **Input** & **Action** \\ \hline \(\$\) & \(cd\$\) & Reduce \\ \hline \(\$\) & \(cd\$\) & Reduce \\ \hline \(\$\) & \(cd\$\) & Shift \\ \hline \(\$\) & \(dc\$\) & Reduce \\ \hline \(\$\) & \(dc\$\) & Shift \\ \hline \(\$\) & \(dc\$\) & Shift \\ \hline \(\$\) & \(cd\$\) & Reduce \\ \hline \(\$\) & \(c\$\) & Shift \\ \hline \(\$\) & \(c\$\) & Shift \\ \hline \(\$\) & \(\$\) & Reduce \\ \hline \(\$\) & \(\$\) & \(Accept\) \\ \hline \hline \end{tabular}
\end{table}
Table 17: _Cont._\(A\longrightarrow aBb\) \(B\longrightarrow a\beta\) Being \(\beta\stackrel{{*}}{{\Longrightarrow}}\varepsilon\vee\beta \stackrel{{*}}{{\Longrightarrow}}\gamma a\). According to the established conditions, the sets for \(B\) in the second production are \(\mathcal{L}(B)=\{a\}\). \(\mathcal{R}(B)=\{a\}\). The precedence relations based on the sections of Algorithm 5 exhibit: \(\bullet\) For the rule (C): \(a\leqslant a\) and \(u=a\). \(\bullet\) For the rule (D.1): \(a\geqslant b\). \(\bullet\) For the rule (D.2): \(a\doteq b\). The application of rules (D.1) and (D.2) generates the conflict. If the \(\mathcal{R}(B)\) does not contain \(a\), then the conflict does not arise. \(A\longrightarrow bBa\) \(B\longrightarrow a\beta\) The sets for \(B\) in the second production are: \(\mathcal{L}(B)=\{a\}\). \(\mathcal{R}(B)=\{a\}\). The precedence relations based on the sections of Algorithm 5 exhibit: \(\bullet\) For the rule (C): \(b\leqslant a\) and \(u=b\). \(\bullet\) For the rule (D.1): \(a\geqslant a\). \(\bullet\) For the rule (D.2): \(b\doteq a\). The application of rules (C) and (D.2) generates the conflict. \(A\longrightarrow bBa\) \(B\longrightarrow\beta a\) Being \(\beta\stackrel{{*}}{{\Longrightarrow}}\varepsilon\vee\beta \stackrel{{*}}{{\Longrightarrow}}a\gamma\). According to the established conditions, the sets for \(B\) in the second production are: \(\mathcal{L}(B)=\{a\}\). \(\mathcal{R}(B)=\{a\}\). The precedence relations based on the sections of Algorithm 5 exhibit: \(\bullet\) For the rule (C): \(b\leqslant a\) and \(u=b\). \(\bullet\) For the rule (D.1): \(a\geqslant a\). \(\bullet\) For the rule (D.2): \(b\doteq a\). The application of rules (C) and (D.2) generates the conflict. If the \(\mathcal{L}(B)\) does not contain \(a\), then the conflict does not arise. When CFG productions take the following form, there will be no conflicts: \(A\longrightarrow aBb\) \(B\longrightarrow\gamma\) where \(\gamma\) has neither \(a\) at the end of the right side nor \(b\) at the end of the left side.