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

static void java_cup::Main::dump_grammar (  )  throws internal_error [inline, static]

Produce a human readable dump of the grammar.

Definition at line 771 of file Main.java.

References java_cup::production_part::is_action(), java_cup::production::lhs(), java_cup::symbol::name(), java_cup::production::rhs(), java_cup::production::rhs_length(), and java_cup::symbol_part::the_symbol().

Referenced by main().

    {
      System.err.println("===== Terminals =====");
      for (int tidx=0, cnt=0; tidx < terminal.number(); tidx++, cnt++)
      {
        System.err.print("["+tidx+"]"+terminal.find(tidx).name()+" ");
        if ((cnt+1) % 5 == 0) System.err.println();
      }
      System.err.println();
      System.err.println();

      System.err.println("===== Non terminals =====");
      for (int nidx=0, cnt=0; nidx < non_terminal.number(); nidx++, cnt++)
      {
        System.err.print("["+nidx+"]"+non_terminal.find(nidx).name()+" ");
        if ((cnt+1) % 5 == 0) System.err.println();
      }
      System.err.println();
      System.err.println();


      System.err.println("===== Productions =====");
      for (int pidx=0; pidx < production.number(); pidx++)
      {
        production prod = production.find(pidx);
        System.err.print("["+pidx+"] "+prod.lhs().the_symbol().name() + " ::= ");
        for (int i=0; i<prod.rhs_length(); i++)
          if (prod.rhs(i).is_action())
            System.err.print("{action} ");
          else
            System.err.print(
                   ((symbol_part)prod.rhs(i)).the_symbol().name() + " ");
        System.err.println();
      }
      System.err.println();
    }


Generated by  Doxygen 1.6.0   Back to index