Ybadoo - Soluções em Software Livre
Tutoriais
Compiladores

Apresente os conjuntos FIRST e FOLLOW das variáveis da gramática a seguir.

G = ({S, A, B, C}, {a, b, c, d}, P, S)
P = {SAC | CdB | Ba
A → aA | BC
B → bB | CB | ε
C → cC | ε}

 

FIRST(S) = {a, b, c, d, ε}
FIRST(A) = {a, b, c, ε}
FIRST(B) = {b, c, ε}
FIRST(C) = {c, ε}
FOLLOW(S) = {$}
FOLLOW(A) = {c, $}
FOLLOW(B) = {a, c, $}
FOLLOW(C) = {a, b, c, d, $}