Logo Search packages:      
Sourcecode: jasmin-sable version File versions  Download package

static void java_cup::Main::main ( String  argv[]  )  throws internal_error, java.io.IOException, java.lang.Exception [inline, static]

The main driver for the system.

Parameters:
argv an array of strings containing command line arguments.

Definition at line 152 of file Main.java.

References build_end, build_parser(), check_end, check_unused(), close_files(), dump_end, dump_grammar(), dump_machine(), dump_tables(), emit_end, emit_parser(), emit_summary(), input_file, lr_values, no_summary, open_files(), opt_dump_grammar, opt_dump_states, opt_dump_tables, parse_args(), parse_end, parse_grammar_spec(), prelim_end, print_progress, and start_time.

    {
      boolean did_output = false;

      start_time = System.currentTimeMillis();

      /* process user options and arguments */
      parse_args(argv);

      /* frankf 6/18/96
       hackish, yes, but works */
      emit.set_lr_values(lr_values);
      /* open output files */
      if (print_progress) System.err.println("Opening files...");
      /* use a buffered version of standard input */
      input_file = new BufferedInputStream(System.in);

      prelim_end = System.currentTimeMillis();

      /* parse spec into internal data structures */
      if (print_progress) 
      System.err.println("Parsing specification from standard input...");
      parse_grammar_spec();

      parse_end = System.currentTimeMillis();

      /* don't proceed unless we are error free */
      if (lexer.error_count == 0)
      {
        /* check for unused bits */
          if (print_progress) System.err.println("Checking specification...");
          check_unused();

          check_end = System.currentTimeMillis();

        /* build the state machine and parse tables */
          if (print_progress) System.err.println("Building parse tables...");
          build_parser();

          build_end = System.currentTimeMillis();

        /* output the generated code, if # of conflicts permits */
        if (lexer.error_count != 0) {
            // conflicts! don't emit code, don't dump tables.
            opt_dump_tables = false;
        } else { // everything's okay, emit parser.
            if (print_progress) System.err.println("Writing parser...");
            open_files();
            emit_parser();
            did_output = true;
        }
      }
      /* fix up the times to make the summary easier */
      emit_end = System.currentTimeMillis();

      /* do requested dumps */
      if (opt_dump_grammar) dump_grammar();
      if (opt_dump_states)  dump_machine(); 
      if (opt_dump_tables)  dump_tables(); 

      dump_end = System.currentTimeMillis();

      /* close input/output files */
      if (print_progress) System.err.println("Closing files...");
      close_files();

      /* produce a summary if desired */
      if (!no_summary) emit_summary(did_output);

      /* If there were errors during the run,
       * exit with non-zero status (makefile-friendliness). --CSA */
      if (lexer.error_count != 0)
        System.exit(100);
    }


Generated by  Doxygen 1.6.0   Back to index