@@ -46,10 +46,10 @@ class LL1Parser {
4646 * production, indicating no conflicts. If conflicts are found, the function
4747 * will return `false`, signaling that the grammar is not LL(1).
4848 *
49- * - For each production rule `A -> α` , the function calculates the director
50- * symbols using the `director_symbols ` function.
49+ * - For each production rule \f(A \rightarrow \alpha\f) , the function
50+ * calculates the prediction symbols using the `PredictionSymbols ` function.
5151 * - It then fills the parsing table at the cell corresponding to the
52- * non-terminal `A` and each director symbol in the set.
52+ * non-terminal `A` and each prediction symbol in the set.
5353 * - If a cell already contains a production, this indicates a conflict,
5454 * meaning the grammar is not LL(1).
5555 *
@@ -103,27 +103,25 @@ class LL1Parser {
103103 /* *
104104 * @brief Computes the FOLLOW sets for all non-terminal symbols in the
105105 * grammar.
106- *
107- * The FOLLOW set of a non-terminal symbol A contains all terminal symbols
108- * that can appear immediately after A in any sentential form derived from
109- * the grammar's start symbol. Additionally, if A can be the last symbol in
110- * a derivation, the end-of-input marker (`$`) is included in its FOLLOW
111- * set.
112- *
106+ * The FOLLOW set of a non-terminal symbol A contains all terminal
107+ * symbols that can appear immediately after A in any sentential form
108+ * derived from the grammar's start symbol. Additionally, if A can be the
109+ * last symbol in a derivation, the end-of-input marker (`\$`) is included
110+ * in its FOLLOW set.
113111 * This function computes the FOLLOW sets using the following rules:
114- * 1. Initialize FOLLOW(S) = { $ }, where S is the start symbol.
115- * 2. For each production rule of the form A → αBβ:
116- * - Add FIRST(β) (excluding ε) to FOLLOW(B).
117- * - If ε ∈ FIRST(β), add FOLLOW(A) to FOLLOW(B).
112+ * 1. Initialize FOLLOW(S) = { \f( \$ \f) }, where S is the start symbol.
113+ * 2. For each production rule of the form \f( A \rightarrow \alpha B \beta
114+ * \f):
115+ * - Add \f( FIRST(\beta) \setminus \{\epsilon\} \f) to \f( FOLLOW(B)
116+ * \f).
117+ * - If \f( \epsilon \in FIRST(\beta) \f), add \f( FOLLOW(A) \f) to
118+ * \f( FOLLOW(B) \f).
118119 * 3. Repeat step 2 until no changes occur in any FOLLOW set.
119- *
120- * The computed FOLLOW sets are cached in the `follow_sets_` member variable
121- * for later use by the parser.
122- *
123- * @note This function assumes that the FIRST sets for all symbols have
124- * already been computed and are available in the `first_sets_` member
120+ * The computed FOLLOW sets are cached in the `follow_sets_` member
121+ * variable for later use by the parser.
122+ * @note This function assumes that the FIRST sets for all symbols
123+ * have already been computed and are available in the `first_sets_` member
125124 * variable.
126- *
127125 * @see First
128126 * @see follow_sets_
129127 */
@@ -148,20 +146,19 @@ class LL1Parser {
148146 /* *
149147 * @brief Computes the prediction symbols for a given
150148 * production rule.
151- *
152- * The prediction symbols for a rule,
153- * determine the set of input symbols that can trigger this rule in the
154- * parsing table. This function calculates the prediction symbols based on
155- * the FIRST set of the consequent and, if epsilon (the empty symbol) is in
156- * the FIRST set, also includes the FOLLOW set of the antecedent.
157- *
158- * - If the FIRST set of the consequent does not contain epsilon, the
159- * prediction symbols are simply the FIRST symbols of the consequent.
149+ * * The prediction symbols for a rule determine the set of input
150+ * symbols that can trigger this rule in the parsing table. This function
151+ * calculates the prediction symbols based on the FIRST set of the
152+ * consequent and, if epsilon (the empty symbol) is in the FIRST set, also
153+ * includes the FOLLOW set of the antecedent.
154+ * * - If the FIRST set of the consequent does not contain epsilon, the
155+ * prediction symbols are simply the FIRST symbols of the consequent.
160156 * - If the FIRST set of the consequent contains epsilon, the prediction
161- * symbols are computed as (FIRST(consequent) - {epsilon}) ∪
162- * FOLLOW(antecedent).
163- *
164- * @param antecedent The left-hand side non-terminal symbol of the rule.
157+ * symbols are computed as
158+ * \f( FIRST(\text{consequent}) \setminus \{\epsilon\} \cup
159+ * FOLLOW(\text{antecedent}) \f).
160+ * * @param antecedent The left-hand side non-terminal symbol of the
161+ * rule.
165162 * @param consequent A vector of symbols on the right-hand side of the rule
166163 * (production body).
167164 * @return An unordered set of strings containing the prediction symbols for
0 commit comments