$E\rightarrow Tx$
$x\rightarrow +E|$empty string
$T\rightarrow (E)|intY$
$Y\rightarrow*T|$empty string
I had hard time looking for follow set for $T$ and $Y$. Cause it will trace back to each other. If I do $Y$, then it will trace back to $T$ when $T$ trace back to $Y$. It is a loop. So how do I look for follow set under this circumstance?
Thank you.
2026-04-24 12:33:17.1777033997
Looking for follow set of Grammar in discrete math
62 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
1
I hope it can help you.
$E\to TX \\ X\to+E|\epsilon \\ T\to(E)|intY \\ Y\to*T|\epsilon$
$E\to \underline {\text{T}}\text{X}\tag{ 2}$
FIRST [X]$-\{\epsilon\}$ $\subseteq $ FOLLOW [T]
{+} $\subseteq $FOLLOW [T]
$T\to (\underline{E})\tag{ 1,2}$
FIRST [ ) ]$-\{\epsilon\}$ $\subseteq $ FOLLOW [E]
{),\$} $\subseteq $FOLLOW [E]
$E\to \text{T}\underline{\text{X}}\tag{ 3}$
FOLLOW(E) $\subseteq$ FOLLOW(X)
$\bullet$ $\epsilon \in FISRT(X) $ so :
FOLLOW(E) $\subseteq$ FOLLOW(T)
$X\to \text{+}\underline{\text{E}}\tag{ 3}$
FOLLOW(X) $\subseteq$ FOLLOW(E)
$T\to \text{int}\underline{\text{Y}}\tag{ 3}$
FOLLOW(T) $\subseteq$ FOLLOW(Y)
$Y\to \text{*}\underline{\text{T}}\tag{ 3}$
FOLLOW(Y) $\subseteq$ FOLLOW(T)
FOLLOW(X) = FOLLOW(E) = $\{),\$\}$
FOLLOW(T) = FOLLOW(Y)
FOLLOW(T) = FOLLOW(Y) = $\{),\$,+\}$
(1) FOLLOW(A) $\subseteq$ FOLLOW(B) : FOLLOW( B ) contains at least the FOLLOW( A ) as a subset.
(2)First and Follow Sets Example