⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parser.java

📁 非常好的编译源代码 将一个l语言转换为中间代码 java版本
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
    "\103\043\074\044\054\045\076\050\067\051\061\067\077" +
    "\070\052\074\062\075\073\104\107\001\001\000\002\001" +
    "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
    "\000\004\014\324\001\001\000\002\001\001\000\002\001" +
    "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
    "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
    "\002\001\001\000\064\004\102\041\143\042\103\043\134" +
    "\044\120\045\131\046\132\047\135\050\145\051\121\053" +
    "\144\054\116\055\136\056\146\057\124\060\140\061\125" +
    "\062\141\063\117\064\137\065\133\066\341\067\126\070" +
    "\052\075\073\001\001\000\002\001\001\000\002\001\001" +
    "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
    "\012\011\346\012\350\013\344\014\347\001\001\000\002" +
    "\001\001\000\002\001\001\000\002\001\001\000\002\001" +
    "\001\000\002\001\001\000\010\011\346\012\350\013\352" +
    "\001\001\000\002\001\001\000\002\001\001\000\002\001" +
    "\001\000\002\001\001\000\002\001\001\000\002\001\001" +
    "\000\002\001\001\000\002\001\001\000\002\001\001\000" +
    "\016\005\364\006\033\007\016\010\022\033\366\034\365" +
    "\001\001\000\002\001\001\000\002\001\001\000\002\001" +
    "\001\000\020\005\371\006\033\007\016\010\022\031\372" +
    "\035\370\036\374\001\001\000\002\001\001\000\002\001" +
    "\001\000\002\001\001\000\002\001\001\000\020\005\371" +
    "\006\033\007\016\010\022\031\372\035\u0100\036\374\001" +
    "\001\000\004\015\376\001\001\000\002\001\001\000\002" +
    "\001\001\000\002\001\001\000\012\011\346\012\350\013" +
    "\u0102\014\u0103\001\001\000\002\001\001\000\002\001\001" +
    "\000\002\001\001\000\002\001\001\000\050\004\102\020" +
    "\u0107\021\055\022\u0108\023\u0109\037\057\040\060\041\065" +
    "\042\103\043\074\044\054\045\076\050\067\051\061\067" +
    "\077\070\052\074\062\075\073\104\107\001\001\000\004" +
    "\076\114\001\001\000\002\001\001\000\050\004\102\020" +
    "\u0107\021\055\022\u010a\023\u0109\037\057\040\060\041\065" +
    "\042\103\043\074\044\054\045\076\050\067\051\061\067" +
    "\077\070\052\074\062\075\073\104\107\001\001\000\002" +
    "\001\001\000\002\001\001\000\066\004\102\041\143\042" +
    "\103\043\134\044\120\045\131\046\132\047\135\050\145" +
    "\051\121\053\144\054\116\055\136\056\146\057\124\060" +
    "\140\061\125\062\141\063\117\064\137\065\133\066\142" +
    "\067\126\070\052\072\u010d\075\073\001\001\000\002\001" +
    "\001\000\002\001\001\000\016\005\364\006\033\007\016" +
    "\010\022\033\u0110\034\365\001\001\000\002\001\001\000" +
    "\002\001\001\000\020\005\371\006\033\007\016\010\022" +
    "\031\372\035\u0113\036\374\001\001\000\002\001\001\000" +
    "\002\001\001\000\044\004\102\020\u0116\021\055\037\057" +
    "\040\060\041\065\042\103\043\074\044\054\045\076\050" +
    "\067\051\061\067\077\070\052\074\062\075\073\104\107" +
    "\001\001\000\004\076\114\001\001\000\002\001\001\000" +
    "\002\001\001" });

  /** Access to <code>reduce_goto</code> table. */
  public short[][] reduce_table() {return _reduce_table;}

  /** Instance of action encapsulation class. */
  protected CUP$Parser$actions action_obj;

  /** Action encapsulation object initializer. */
  protected void init_actions()
    {
      action_obj = new CUP$Parser$actions(this);
    }

  /** Invoke a user supplied parse action. */
  public java_cup.runtime.Symbol do_action(
    int                        act_num,
    java_cup.runtime.lr_parser parser,
    java.util.Stack            stack,
    int                        top)
    throws java.lang.Exception
  {
    /* call code in generated class */
    return action_obj.CUP$Parser$do_action(act_num, parser, stack, top);
  }

  /** Indicates start state. */
  public int start_state() {return 0;}
  /** Indicates start production. */
  public int start_production() {return 0;}

  /** <code>EOF</code> Symbol index. */
  public int EOF_sym() {return 0;}

  /** <code>error</code> Symbol index. */
  public int error_sym() {return 1;}


 	  public void report_error(String message, Object info) {    StringBuffer m = new StringBuffer("Error ");    if (info instanceof java_cup.runtime.Symbol)       m.append( "("+info.toString()+")" );         m.append(" : "+message);       System.out.println(m);  }     public void report_fatal_error(String message, Object info) {    report_error(message, info);    throw new RuntimeException("Fatal Syntax Error");  }
}

/** Cup generated class to encapsulate user supplied action code.*/
class CUP$Parser$actions {

//生成的四元式列表private CodeTable codeTable=new CodeTable();//存放各个数组的信息private SymTable symTable = new SymTable();//存放各个数组的信息private HashMap array=new HashMap();//数组信息的暂时存放private ArrayList tempArray;//调用参数信息的暂时存放private ArrayList callList;/****数组方面计算 详见 p180 7.6,7.7*///第row位的大小private  int limit(String arrayName, int row) {	ArrayList cur=(ArrayList)array.get(arrayName);	return ((Integer)cur.get(row-1)).intValue();}//书中 p180 7.7 我的下界认定为 0!private int C(String arrayName) {	return 0;}//数组元素的宽度private int W(String arrayName) {		return 1;}
  private final Parser parser;

  /** Constructor */
  CUP$Parser$actions(Parser parser) {
    this.parser = parser;
  }

  /** Method with the actual generated action code. */
  public final java_cup.runtime.Symbol CUP$Parser$do_action(
    int                        CUP$Parser$act_num,
    java_cup.runtime.lr_parser CUP$Parser$parser,
    java.util.Stack            CUP$Parser$stack,
    int                        CUP$Parser$top)
    throws java.lang.Exception
    {
      /* Symbol object for return from actions */
      java_cup.runtime.Symbol CUP$Parser$result;

      /* select the action based on the action number */
      switch (CUP$Parser$act_num)
        {
          /*. . . . . . . . . . . . . . . . . . . .*/
          case 154: // floating_point_type ::= REAL 
            {
              Object RESULT = null;

              CUP$Parser$result = new java_cup.runtime.Symbol(6/*floating_point_type*/, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-0)).right, RESULT);
            }
          return CUP$Parser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 153: // floating_point_type ::= FLOAT 
            {
              Object RESULT = null;

              CUP$Parser$result = new java_cup.runtime.Symbol(6/*floating_point_type*/, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-0)).right, RESULT);
            }
          return CUP$Parser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 152: // integral_type ::= CHAR 
            {
              Object RESULT = null;

              CUP$Parser$result = new java_cup.runtime.Symbol(5/*integral_type*/, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-0)).right, RESULT);
            }
          return CUP$Parser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 151: // integral_type ::= LONG 
            {
              Object RESULT = null;

              CUP$Parser$result = new java_cup.runtime.Symbol(5/*integral_type*/, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-0)).right, RESULT);
            }
          return CUP$Parser$result;

          /*. . . . . . . . . . . . . . . . . . . .*/
          case 150: // integral_t

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -