+ timevar_push (TV_READER);
+ reader ();
+ timevar_pop (TV_READER);
+
+ if (complaint_issued)
+ goto finish;
+
+ /* Find useless nonterminals and productions and reduce the grammar. */
+ timevar_push (TV_REDUCE);
+ reduce_grammar ();
+ timevar_pop (TV_REDUCE);
+
+ /* Record other info about the grammar. In files derives and
+ nullable. */
+ timevar_push (TV_SETS);
+ derives_compute ();
+ nullable_compute ();
+ timevar_pop (TV_SETS);
+
+ /* Compute LR(0) parser states. See state.h for more info. */
+ timevar_push (TV_LR0);
+ generate_states ();
+ timevar_pop (TV_LR0);
+
+ /* Add lookahead sets to parser states. Except when LALR(1) is
+ requested, split states to eliminate LR(1)-relative
+ inadequacies. */
+ ielr ();
+
+ /* Find and record any conflicts: places where one token of
+ lookahead is not enough to disambiguate the parsing. In file
+ conflicts. Also resolve s/r conflicts based on precedence
+ declarations. */
+ timevar_push (TV_CONFLICTS);
+ conflicts_solve ();
+ if (!muscle_percent_define_flag_if ("lr.keep-unreachable-states"))
+ {
+ state_number *old_to_new = xnmalloc (nstates, sizeof *old_to_new);
+ state_number nstates_old = nstates;
+ state_remove_unreachable_states (old_to_new);
+ lalr_update_state_numbers (old_to_new, nstates_old);
+ conflicts_update_state_numbers (old_to_new, nstates_old);
+ free (old_to_new);
+ }
+ conflicts_print ();
+ timevar_pop (TV_CONFLICTS);