📄 parser.java
字号:
"\024\044\025\051\027\054\030\050\031\047\032\061\040" +
"\046\001\001\000\026\015\131\022\056\023\045\024\044" +
"\025\051\027\054\030\050\031\047\032\061\040\046\001" +
"\001\000\026\015\130\022\056\023\045\024\044\025\051" +
"\027\054\030\050\031\047\032\061\040\046\001\001\000" +
"\026\015\127\022\056\023\045\024\044\025\051\027\054" +
"\030\050\031\047\032\061\040\046\001\001\000\026\015" +
"\126\022\056\023\045\024\044\025\051\027\054\030\050" +
"\031\047\032\061\040\046\001\001\000\026\015\125\022" +
"\056\023\045\024\044\025\051\027\054\030\050\031\047" +
"\032\061\040\046\001\001\000\026\015\124\022\056\023" +
"\045\024\044\025\051\027\054\030\050\031\047\032\061" +
"\040\046\001\001\000\026\015\123\022\056\023\045\024" +
"\044\025\051\027\054\030\050\031\047\032\061\040\046" +
"\001\001\000\026\015\122\022\056\023\045\024\044\025" +
"\051\027\054\030\050\031\047\032\061\040\046\001\001" +
"\000\026\015\121\022\056\023\045\024\044\025\051\027" +
"\054\030\050\031\047\032\061\040\046\001\001\000\026" +
"\015\120\022\056\023\045\024\044\025\051\027\054\030" +
"\050\031\047\032\061\040\046\001\001\000\026\015\117" +
"\022\056\023\045\024\044\025\051\027\054\030\050\031" +
"\047\032\061\040\046\001\001\000\002\001\001\000\026" +
"\015\116\022\056\023\045\024\044\025\051\027\054\030" +
"\050\031\047\032\061\040\046\001\001\000\026\015\115" +
"\022\056\023\045\024\044\025\051\027\054\030\050\031" +
"\047\032\061\040\046\001\001\000\026\015\114\022\056" +
"\023\045\024\044\025\051\027\054\030\050\031\047\032" +
"\061\040\046\001\001\000\026\015\113\022\056\023\045" +
"\024\044\025\051\027\054\030\050\031\047\032\061\040" +
"\046\001\001\000\026\015\112\022\056\023\045\024\044" +
"\025\051\027\054\030\050\031\047\032\061\040\046\001" +
"\001\000\026\015\111\022\056\023\045\024\044\025\051" +
"\027\054\030\050\031\047\032\061\040\046\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\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\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\032\015\144\022" +
"\056\023\045\024\044\025\051\027\054\030\050\031\047" +
"\032\061\033\143\035\145\040\046\001\001\000\004\034" +
"\150\001\001\000\002\001\001\000\002\001\001\000\002" +
"\001\001\000\030\015\144\022\056\023\045\024\044\025" +
"\051\027\054\030\050\031\047\032\061\033\151\040\046" +
"\001\001\000\002\001\001\000\004\034\152\001\001\000" +
"\002\001\001\000\030\014\154\015\155\022\056\023\045" +
"\024\044\025\051\027\054\030\050\031\047\032\061\040" +
"\046\001\001\000\002\001\001\000\002\001\001\000\002" +
"\001\001\000\002\001\001\000\002\001\001\000\026\011" +
"\163\012\032\013\033\016\024\017\023\020\027\021\026" +
"\032\037\036\030\037\162\001\001\000\002\001\001\000" +
"\002\001\001\000\024\011\165\012\032\013\033\016\024" +
"\017\023\020\027\021\026\032\037\036\030\001\001\000" +
"\002\001\001\000\002\001\001\000\002\001\001\000\002" +
"\001\001\000\002\001\001\000\026\015\174\022\056\023" +
"\045\024\173\025\051\027\054\030\050\031\047\032\061" +
"\040\046\001\001\000\004\042\205\001\001\000\002\001" +
"\001\000\004\024\176\001\001\000\004\042\200\001\001" +
"\000\002\001\001\000\024\011\201\012\032\013\033\016" +
"\024\017\023\020\027\021\026\032\037\036\030\001\001" +
"\000\002\001\001\000\004\020\203\001\001\000\002\001" +
"\001\000\002\001\001\000\004\043\206\001\001\000\024" +
"\011\213\012\032\013\033\016\024\017\023\020\027\021" +
"\026\032\037\036\030\001\001\000\026\015\212\022\056" +
"\023\045\024\044\025\051\027\054\030\050\031\047\032" +
"\061\040\046\001\001\000\026\015\211\022\056\023\045" +
"\024\044\025\051\027\054\030\050\031\047\032\061\040" +
"\046\001\001\000\002\001\001\000\002\001\001\000\002" +
"\001\001\000\004\020\215\001\001\000\002\001\001\000" +
"\004\047\217\001\001\000\002\001\001\000\002\001\001" +
"\000\014\004\222\005\005\006\007\007\010\010\006\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;}
private static Program prog; public static void setProgram(Program p) {prog = p;} public static Program getProgram() {return prog;} public static java_cup.runtime.Symbol lastSym; public java_cup.runtime.Symbol scan() { try { java_cup.runtime.Symbol s = getScanner().next_token(); lastSym = s; return s; } catch (Exception e) { return null; } } public void report_error(String message, Object info) { Symbol cur_token = (Symbol) info; String errorMsg = ""; //System.out.println("errorMsg = " + errorMsg); //System.out.println("cur_token.sym = " + cur_token.sym); if (message.equals("Syntax error")) { if (cur_token.sym == 0) errorMsg = "Bad Syntax - Possibly missing clause"; else errorMsg = "Syntax error at " + cur_token + " " + cur_token.value; } errorMsg += "\nCan't parse program at " + cur_token + " "+ cur_token.value; System.out.println("errorMsg = " + errorMsg); }
}
/** Cup generated class to encapsulate user supplied action code.*/
class CUP$Parser$actions {
Vector declarations = new Vector(); Vector statements = new Vector(); private Program p;
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 77: // conditional ::= expression LESS_THAN expression
{
Expression RESULT = null;
int e1left = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).left; int e1right = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).right; Expression e1 = (Expression)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-2)).value; int e2left = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-0)).left; int e2right = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-0)).right; Expression e2 = (Expression)((java_cup.runtime.Symbol) CUP$Parser$stack.elementAt(CUP$Parser$top-0)).value; RESULT = new ConditionalLessExpression(e1, e2);
CUP$Parser$result = new java_cup.runtime.Symbol(30/*conditional*/, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-0)).right, RESULT);
}
return CUP$Parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 76: // conditional ::= expression GREATER_THAN expression
{
Expression RESULT = null;
int e1left = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).left; int e1right = ((java_cup.runtime.Symbol)CUP$Parser$stack.elementAt(CUP$Parser$top-2)).right;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -