- lalr();
-
- /* 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. */
- initialize_conflicts();
-
- /* print information about results, if requested. In file print. */
- if (verboseflag)
- verbose();
- else
- terse();
-
- /* output the tables and the parser to ftable. In file output. */
- output();
- done(failure);
-}
-
-/* functions to report errors which prevent a parser from being generated */
-
-void
-fatal(s)
-char *s;
-{
- extern char *infile;
-
- if (infile == 0)
- fprintf(stderr, "fatal error: %s\n", s);
- else
- fprintf(stderr, "\"%s\", line %d: %s\n", infile, lineno, s);
- done(1);
-}
-
-
-/* JF changed to accept/deal with variable args.
- DO NOT change this to use varargs. It will appear to work
- but will break on systems that don't have the necessary library
- functions. This is the ONLY safe way to write such a function. */
-/*VARARGS1*/
-
-void
-fatals(fmt,x1,x2,x3,x4,x5,x6,x7,x8)
-char *fmt;
-{
- char buffer[200];
-
- sprintf(buffer, fmt, x1,x2,x3,x4,x5,x6,x7,x8);
- fatal(buffer);
-}
-
-
-void
-toomany(s)
-char *s;
-{
- char buffer[200];
-
- /* JF new msg */
- sprintf(buffer, "limit of %d exceeded, too many %s", MAXSHORT, s);
- fatal(buffer);
-}
-
-
-void
-berror(s)
-char *s;
-{
- fprintf(stderr, "internal error, %s\n", s);
- abort();
+ lalr ();
+
+ /* 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. */
+ solve_conflicts ();
+ conflicts_print ();
+
+ /* Output file names. */
+ compute_output_file_names ();
+
+ /* Output the detailed report on the grammar. */
+ if (verbose_flag)
+ print_results ();
+
+ /* Stop if there were errors, to avoid trashing previous output
+ files. */
+ if (complain_message_count)
+ exit (1);
+
+ /* Output the VCG graph. */
+ if (graph_flag)
+ print_graph ();
+
+ /* Output the tables and the parser to ftable. In file output. */
+ output ();
+
+ reduce_free ();
+ free_conflicts ();
+ free_nullable ();
+ free_derives ();
+ grammar_free ();
+
+ /* If using alloca.c, flush the alloca'ed memory for the benefit of
+ people running Bison as a library in IDEs. */
+#if C_ALLOCA
+ alloca (0);
+#endif
+
+ return complain_message_count ? EXIT_FAILURE : EXIT_SUCCESS;