@@ -20,7 +20,7 @@ class LL1Parser {
2020 * @param gr Grammar object to parse with.
2121 * @param text_file Name of the file containing input to parse.
2222 */
23- LL1Parser (grammar gr, std::string text_file);
23+ LL1Parser (Grammar gr, std::string text_file);
2424
2525 /* *
2626 * @brief Constructs an LL1Parser with a grammar file and an input file.
@@ -64,14 +64,14 @@ class LL1Parser {
6464 * to the LL(1) grammar; `false` if parsing fails due to a mismatch,
6565 * conflict, or unexpected input symbol.
6666 */
67- bool parse ();
67+ bool Parse ();
6868
6969 /* *
7070 * @brief Print the LL(1) parsing table to standard output.
7171 *
7272 * Displays the LL(1) table for debugging and analysis.
7373 */
74- void print_table ();
74+ void PrintTable ();
7575
7676 /* *
7777 * @brief Prints the remaining symbols in the parsing stack after the
@@ -83,15 +83,15 @@ class LL1Parser {
8383 * provides insight into where the parsing process may have diverged from
8484 * expected behavior.
8585 */
86- void print_stack_trace ();
86+ void PrintStackTrace ();
8787
8888 /* *
89- * @brief Prints the last TRACE_SIZE symbols processed.
89+ * @brief Prints the last kTraceSize symbols processed.
9090 *
9191 * Primarily used to identify the most recent tokens processed in case
9292 * of parsing errors.
9393 */
94- void print_symbol_hist ();
94+ void PrintSymbolHist ();
9595
9696 private:
9797 /* *
@@ -120,7 +120,7 @@ class LL1Parser {
120120 * symbols that can start derivations of the rule, and possibly epsilon if
121121 * the rule can derive an empty string.
122122 */
123- void first (std::span<const std::string> rule,
123+ void First (std::span<const std::string> rule,
124124 std::unordered_set<std::string>& result);
125125
126126 /* *
@@ -133,7 +133,7 @@ class LL1Parser {
133133 * expanding and updating the sets until no further changes occur (i.e., a
134134 * fixed-point is reached).
135135 */
136- void compute_first_sets ();
136+ void ComputFirstSets ();
137137
138138 /* *
139139 * @brief Computes the FOLLOW set for a given non-terminal symbol in the
@@ -153,33 +153,33 @@ class LL1Parser {
153153 * @return An unordered set of strings containing symbols that form the
154154 * FOLLOW set for `arg`.
155155 */
156- std::unordered_set<std::string> follow (const std::string& arg);
156+ std::unordered_set<std::string> Follow (const std::string& arg);
157157
158158 /* *
159- * @brief Computes the director symbols ( prediction symbols) for a given
159+ * @brief Computes the prediction symbols for a given
160160 * production rule.
161161 *
162- * The director symbols for a rule, also called prediction symbols ,
162+ * The prediction symbols for a rule,
163163 * determine the set of input symbols that can trigger this rule in the
164- * parsing table. This function calculates the director symbols based on the
165- * FIRST set of the consequent and, if epsilon (the empty symbol) is in the
166- * FIRST set, also includes the FOLLOW set of the antecedent.
164+ * parsing table. This function calculates the prediction symbols based on
165+ * the FIRST set of the consequent and, if epsilon (the empty symbol) is in
166+ * the FIRST set, also includes the FOLLOW set of the antecedent.
167167 *
168168 * - If the FIRST set of the consequent does not contain epsilon, the
169- * director symbols are simply the FIRST symbols of the consequent.
170- * - If the FIRST set of the consequent contains epsilon, the director
169+ * prediction symbols are simply the FIRST symbols of the consequent.
170+ * - If the FIRST set of the consequent contains epsilon, the prediction
171171 * symbols are computed as (FIRST(consequent) - {epsilon}) ∪
172172 * FOLLOW(antecedent).
173173 *
174174 * @param antecedent The left-hand side non-terminal symbol of the rule.
175175 * @param consequent A vector of symbols on the right-hand side of the rule
176176 * (production body).
177- * @return An unordered set of strings containing the director symbols for
177+ * @return An unordered set of strings containing the prediction symbols for
178178 * the specified rule.
179179 */
180180 std::unordered_set<std::string>
181- director_symbols (const std::string& antecedent,
182- const std::vector<std::string>& consequent);
181+ PredictionSymbols (const std::string& antecedent,
182+ const std::vector<std::string>& consequent);
183183
184184 /* *
185185 * @brief Recursive utility function to compute the FOLLOW set for a
@@ -203,9 +203,9 @@ class LL1Parser {
203203 * @param next_symbols An unordered set to accumulate symbols forming the
204204 * FOLLOW set of the target non-terminal as they are discovered.
205205 */
206- void follow_util (const std::string& arg,
207- std::unordered_set<std::string>& visited,
208- std::unordered_set<std::string>& next_symbols);
206+ void FollowUtil (const std::string& arg,
207+ std::unordered_set<std::string>& visited,
208+ std::unordered_set<std::string>& next_symbols);
209209
210210 /* *
211211 * @brief Creates the LL(1) parsing table for the grammar.
@@ -228,25 +228,25 @@ class LL1Parser {
228228 * grammar is LL(1) compatible; `false` if any conflicts are detected,
229229 * showing that the grammar does not meet LL(1) requirements.
230230 */
231- bool create_ll1_table ();
231+ bool CreateLL1Table ();
232232
233233 // / @brief Size limit for symbol history trace, defaults to 5.
234- const size_t TRACE_SIZE {5 };
234+ const size_t kTraceSize {5 };
235235
236236 // / @brief The LL(1) parsing table, mapping non-terminals and terminals to
237237 // / productions.
238238 ll1_table ll1_t_;
239239
240240 // / @brief Grammar object associated with this parser.
241- grammar gr_;
241+ Grammar gr_;
242242
243243 // / @brief FIRST sets for each non-terminal in the grammar.
244244 std::unordered_map<std::string, std::unordered_set<std::string>> first_sets;
245245
246246 // / @brief Stack for managing parsing symbols.
247247 std::stack<std::string> symbol_stack_;
248248
249- // / @brief Deque for tracking the most recent TRACE_SIZE symbols parsed.
249+ // / @brief Deque for tracking the most recent kTraceSize symbols parsed.
250250 std::deque<std::string> trace_;
251251
252252 // / @brief Path to the grammar file used in this parser.
0 commit comments