# Precedence Table Construction Algorithm for CFGs Regardless of Being OPGs
## 5 Examples
### Example 2
#### 5.2.3. Right  
The Right sets are calculated as detailed in Table 9. \begin{table}
\begin{tabular}{l l l l} \hline Right(\(S\)) & & & & \\ \hline \multicolumn{4}{l}{For \(S\longrightarrow SD\);} & \multicolumn{2}{l}{For \(S\longrightarrow D\);} \\ \hline \multirow{4}{*}{1. Evaluating the **second**} & \(A=S\) & & \(A=S\) \\  & \(\gamma=SD\) & & \(\gamma=D\) \\  & \(a=\); & 2. Evaluating the **second** & \(\gamma=\) & \(a=\); \\  & conditional of Algorithm 4. & \(\beta=\varepsilon\) & conditional of Algorithm 4. & \(\beta=\varepsilon\) \\  & \(\mathcal{R}(S)\supseteq\{;\}\) & & \(\mathcal{R}(S)=\{;\}\) \\ \hline \multicolumn{4}{l}{Right(\(D\))} \\ \hline \multicolumn{4}{l}{For \(D\longrightarrow\mathit{Tid}(L)\)} \\ \hline \multirow{4}{*}{1. Evaluating the **second**} & \(A=D\) & & \\  & \(\gamma=\mathit{Tid}(L\) & & \\  & conditional of Algorithm 4. & \(a=\)) & \\  & \(\mathcal{R}(D)=\{\}\) & & \\ \hline \multicolumn{4}{l}{Right(\(T\))} \\ \hline \multicolumn{4}{l}{For \(T\longrightarrow T*\)} & \multicolumn{2}{l}{For \(T\longrightarrow int\)} \\ \hline \multirow{4}{*}{1. Evaluating the **second**} & \(A=T\) & & \(A=T\) \\  & \(\gamma=T\) & & \(\gamma=\varepsilon\) \\  & conditional of Algorithm 4. & \(a=\ast\) & conditional of Algorithm 4. & \(a=int\) \\  & \(\mathcal{R}(T)\supseteq\{*\}\) & & \(\mathcal{R}(T)=\{*,int\}\) \\ \hline \multicolumn{4}{l}{Right(\(L\))} \\ \hline \multicolumn{4}{l}{For \(L\longrightarrow I\)} \\ \hline \multicolumn{4}{l}{
\begin{tabular}{l} \(\mathcal{R}(L)=\mathcal{R}(I)\) \\ \end{tabular} } \\ \hline \end{tabular}
\end{table} 
Table 9: Right Sets calculation for the CFG in Example 2. Summary of Right sets of non-terminals:  
\(\bullet\) Right(\(S\)) = \(\{:\}\). \(\bullet\) Right(\(D\)) = \(\{\}\). \(\bullet\) Right(\(T\)) = \(\{*,int\}\). \(\bullet\) Right(\(L\)) = \(\mathcal{R}(I)\). \(\bullet\) Right(\(I\)) = \(\mathcal{R}(T)\cup\{,\}\). Substituting the sets:  
\(\bullet\) Right(\(S\)) = \(\{:\}\). \(\bullet\) Right(\(D\)) = \(\{\}\). \(\bullet\) Right(\(T\)) = \(\{*,int\}\). \(\bullet\) Right(\(L\)) = \(\{,*,int\}\). \(\bullet\) Right(\(I\)) = \(\{,*,int\}\). 5.2.4. Leftmost  
The Leftmost sets are calculated as detailed in Table 10. \begin{table}
\begin{tabular}{l l l l} \hline \hline \multicolumn{2}{l}{Leftmost(\(S\))} & & \multicolumn{2}{l}{For \(S\longrightarrow D\);} \\ \hline \multicolumn{2}{l}{For \(S\longrightarrow SD\);} & & \multicolumn{2}{l}{For \(S\longrightarrow D\);} \\ \hline \multirow{4}{*}{1. Evaluating the **first** conditional of Algorithm 3.} & \(A=S\) & & \(A=S\) \\  & \(\beta=\varepsilon\) & & \(\beta=\varepsilon\) \\  & \(B=S\) & & \(\mathcal{L}_{m}(S)\supseteq\mathcal{L}_{m}(S)\) & \\ \hline \multicolumn{2}{l}{Leftmost(\(D\))} & & & \\ \hline \multicolumn{2}{l}{For \(D\longrightarrow\mathit{Tid}(L)\)} & & & \\ \hline \multicolumn{2}{l}{\begin{tabular}{l} \\ \end{tabular} } & \(A=D\) & & \\ \(\beta=\varepsilon\) & & \(\mathcal{B}=\varepsilon\) & \\  & \(B=T\) & & \(\mathcal{L}_{m}(S)=\mathcal{L}_{m}(D)\) \\ \hline \multicolumn{2}{l}{\begin{tabular}{l} \\ \end{tabular} } \\ \hline \multicolumn{2}{l}{\begin{tabular}{l} \\ \end{tabular} } \\ \hline \multicolumn{2}{l}{\
\begin{tabular}{l} \\ \end{tabular} } \\ \end{tabular} \\ \hline \multicolumn{2}{l}{
\begin{tabular}{l} \\ \end{tabular} } \\ \end{tabular} \\ \hline \hline \end{tabular}
\end{table} 
Table 10: Leftmost Sets calculation for the CFG in Example 2.