FIRST集
$FIRST集合$
------------------------------------------------------------------------
$ S\rightarrow a..., \\
a \ \ \in FIRST(S)\\
$
------------------------------------------------------------------------
$S\rightarrow \epsilon, \\
\epsilon \in FIRST(S)\\
$
------------------------------------------------------------------------
$S\rightarrow Y_{1}Y_{2}Y_{3}...Y_{N},\\
FIRST(Y_{1})/\epsilon \subset FIRST(S) \\
if \ \ \epsilon \in FIRST(Y_{1})\\
FIRST(Y_{2})/\epsilon \subset FIRST(S)\\
\\if \ \ \epsilon \in FIRST(Y_{1}),\epsilon \ in FIRST(Y_{2})\\
FIRST(Y{3})/\epsilon \subset FIRST(S)\\
if \ \ \epsilon \in FIRST(Y_{1}),\epsilon \ in FIRST(Y_{2}),\epsilon \in FIRST(Y_{3})\\
FIRST(Y_{4})/\epsilon \subset FIRST(S)\\
.........以此类推\\
if \ \ \epsilon \in FIRST(Y_{1}),\epsilon \ in FIRST(Y_{2}),\epsilon \in FIRST(Y_{3}),...\epsilon \in FIRST(Y_{n})\\
\epsilon \in FIRST(S)\\
\\
\\
$
FOLLOW集
$FOLLOW集合$
------------------------------------------------------------------------
$A->xB\\
FOLLOW(A) \subset FOLLOW(B)\\
$
------------------------------------------------------------------------
$A->xBY_{1}Y_{2}...Y_{n}\\
FIRST(Y_{1}) \subset FOLLOW(B)\\
if \ \ \epsilon \in FIRST(Y_{1})\\
FIRST(Y_{2}) \subset FOLLOW(B)\\
if( \\ \epsilon \in FIRST(Y_{1}), \epsilon \in FIRST(Y_{2})\\
FIRST(Y_{3}) \subset FOLLOW(B)\\
.....以此类推\\
if \ \ \epsilon \in FIRST(Y_{1}),\epsilon \ in FIRST(Y_{2}),\epsilon \in FIRST(Y_{3}),...\epsilon \in FIRST(Y_{n})\\
\epsilon \in FIRST(S)\\
FOLLOW(A) \subset FOLLOW(B)\\
$