//---------------------------------------------------- // The following code was generated by CUP v0.10j // Mon Jan 08 02:59:26 CET 2007 //---------------------------------------------------- package de.tu_dresden.inf.ggp06_2.parser; import de.tu_dresden.inf.ggp06_2.resolver.*; /** CUP v0.10j generated parser. * @version Mon Jan 08 02:59:26 CET 2007 */ public class preKIFParser extends java_cup.runtime.lr_parser { /** Default constructor. */ public preKIFParser() {super();} /** Constructor which sets the default scanner. */ public preKIFParser(java_cup.runtime.Scanner s) {super(s);} /** Production table. */ protected static final short _production_table[][] = unpackFromStrings(new String[] { "\000\012\000\002\003\004\000\002\002\004\000\002\003" + "\003\000\002\005\006\000\002\005\005\000\002\004\004" + "\000\002\004\003\000\002\006\003\000\002\006\003\000" + "\002\006\003" }); /** Access to production table. */ @Override public short[][] production_table() {return _production_table;} /** Parse-action table. */ protected static final short[][] _action_table = unpackFromStrings(new String[] { "\000\017\000\004\004\005\001\002\000\006\002\021\004" + "\005\001\002\000\004\010\007\001\002\000\006\002\uffff" + "\004\uffff\001\002\000\012\004\005\005\014\006\015\007" + "\011\001\002\000\012\004\005\005\017\006\015\007\011" + "\001\002\000\012\004\ufff9\005\ufff9\006\ufff9\007\ufff9\001" + "\002\000\012\004\ufffb\005\ufffb\006\ufffb\007\ufffb\001\002" + "\000\012\004\ufff8\005\ufff8\006\ufff8\007\ufff8\001\002\000" + "\014\002\ufffd\004\ufffd\005\ufffd\006\ufffd\007\ufffd\001\002" + "\000\012\004\ufffa\005\ufffa\006\ufffa\007\ufffa\001\002\000" + "\012\004\ufffc\005\ufffc\006\ufffc\007\ufffc\001\002\000\014" + "\002\ufffe\004\ufffe\005\ufffe\006\ufffe\007\ufffe\001\002\000" + "\006\002\001\004\001\001\002\000\004\002\000\001\002" + "" }); /** Access to parse-action table. */ @Override public short[][] action_table() {return _action_table;} /** <code>reduce_goto</code> table. */ protected static final short[][] _reduce_table = unpackFromStrings(new String[] { "\000\017\000\006\003\003\005\005\001\001\000\004\005" + "\017\001\001\000\002\001\001\000\002\001\001\000\010" + "\004\007\005\012\006\011\001\001\000\006\005\012\006" + "\015\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" + "" }); /** Access to <code>reduce_goto</code> table. */ @Override public short[][] reduce_table() {return _reduce_table;} /** Instance of action encapsulation class. */ protected CUP$preKIFParser$actions action_obj; /** Action encapsulation object initializer. */ @Override protected void init_actions() { action_obj = new CUP$preKIFParser$actions(this); } /** Invoke a user supplied parse action. */ @Override public java_cup.runtime.Symbol do_action( int act_num, java_cup.runtime.lr_parser parser, java.util.Stack stack2, int top) throws java.lang.Exception { /* call code in generated class */ return action_obj.CUP$preKIFParser$do_action(act_num, parser, stack2, top); } /** Indicates start state. */ @Override public int start_state() {return 0;} /** Indicates start production. */ @Override public int start_production() {return 1;} /** <code>EOF</code> Symbol index. */ @Override public int EOF_sym() {return 0;} /** <code>error</code> Symbol index. */ @Override public int error_sym() {return 1;} } /** Cup generated class to encapsulate user supplied action code.*/ class CUP$preKIFParser$actions { //private final preKIFParser parser; /** Constructor */ CUP$preKIFParser$actions(preKIFParser parser) { //this.parser = parser; } /** Method with the actual generated action code. */ public final java_cup.runtime.Symbol CUP$preKIFParser$do_action( int CUP$preKIFParser$act_num, java_cup.runtime.lr_parser CUP$preKIFParser$parser, java.util.Stack CUP$preKIFParser$stack, int CUP$preKIFParser$top) throws java.lang.Exception { /* Symbol object for return from actions */ java_cup.runtime.Symbol CUP$preKIFParser$result; /* select the action based on the action number */ switch (CUP$preKIFParser$act_num) { /*. . . . . . . . . . . . . . . . . . . .*/ case 9: // term ::= expr { Expression RESULT = null; //int eleft = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).left; //int eright = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).right; Expression e = (Expression)((java_cup.runtime.Symbol) CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).value; RESULT = e; CUP$preKIFParser$result = new java_cup.runtime.Symbol(4/*term*/, ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).right, RESULT); } return CUP$preKIFParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 8: // term ::= CONSTANT { Expression RESULT = null; //int aleft = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).left; //int aright = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).right; String a = (String)((java_cup.runtime.Symbol) CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).value; RESULT = new Atom(a); CUP$preKIFParser$result = new java_cup.runtime.Symbol(4/*term*/, ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).right, RESULT); } return CUP$preKIFParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 7: // term ::= VARIABLE { Expression RESULT = null; //int vleft = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).left; //int vright = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).right; String v = (String)((java_cup.runtime.Symbol) CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).value; RESULT = new Variable(v); CUP$preKIFParser$result = new java_cup.runtime.Symbol(4/*term*/, ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).right, RESULT); } return CUP$preKIFParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 6: // term_list ::= term { ExpressionList RESULT = null; //int tleft = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).left; //int tright = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).right; Expression t = (Expression)((java_cup.runtime.Symbol) CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).value; RESULT = ExpressionList.addToList(null, t); CUP$preKIFParser$result = new java_cup.runtime.Symbol(2/*term_list*/, ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).right, RESULT); } return CUP$preKIFParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 5: // term_list ::= term_list term { ExpressionList RESULT = null; //int tlleft = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-1)).left; //int tlright = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-1)).right; ExpressionList tl = (ExpressionList)((java_cup.runtime.Symbol) CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-1)).value; //int tleft = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).left; //int tright = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).right; Expression t = (Expression)((java_cup.runtime.Symbol) CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).value; RESULT = ExpressionList.addToList(tl, t); CUP$preKIFParser$result = new java_cup.runtime.Symbol(2/*term_list*/, ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).right, RESULT); } return CUP$preKIFParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 4: // expr ::= OPEN PREDICATE CLOSE { Expression RESULT = null; //int aleft = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-1)).left; //int aright = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-1)).right; String a = (String)((java_cup.runtime.Symbol) CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-1)).value; RESULT = new Predicate( new Atom(a), new ExpressionList() ); CUP$preKIFParser$result = new java_cup.runtime.Symbol(3/*expr*/, ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).right, RESULT); } return CUP$preKIFParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 3: // expr ::= OPEN PREDICATE term_list CLOSE { Expression RESULT = null; //int aleft = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-2)).left; //int aright = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-2)).right; String a = (String)((java_cup.runtime.Symbol) CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-2)).value; //int tlleft = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-1)).left; //int tlright = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-1)).right; ExpressionList tl = (ExpressionList)((java_cup.runtime.Symbol) CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-1)).value; RESULT = new Predicate( new Atom(a), tl ); CUP$preKIFParser$result = new java_cup.runtime.Symbol(3/*expr*/, ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-3)).left, ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).right, RESULT); } return CUP$preKIFParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 2: // expr_list ::= expr { ExpressionList RESULT = null; //int eleft = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).left; //int eright = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).right; Expression e = (Expression)((java_cup.runtime.Symbol) CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).value; RESULT = ExpressionList.addToList(null, e); CUP$preKIFParser$result = new java_cup.runtime.Symbol(1/*expr_list*/, ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).right, RESULT); } return CUP$preKIFParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 1: // $START ::= expr_list EOF { Object RESULT = null; //int start_valleft = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-1)).left; //int start_valright = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-1)).right; ExpressionList start_val = (ExpressionList)((java_cup.runtime.Symbol) CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-1)).value; RESULT = start_val; CUP$preKIFParser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).right, RESULT); } /* ACCEPT */ CUP$preKIFParser$parser.done_parsing(); return CUP$preKIFParser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 0: // expr_list ::= expr_list expr { ExpressionList RESULT = null; //int elleft = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-1)).left; //int elright = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-1)).right; ExpressionList el = (ExpressionList)((java_cup.runtime.Symbol) CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-1)).value; //int eleft = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).left; //int eright = ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).right; Expression e = (Expression)((java_cup.runtime.Symbol) CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).value; RESULT = ExpressionList.addToList(el, e); CUP$preKIFParser$result = new java_cup.runtime.Symbol(1/*expr_list*/, ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$preKIFParser$stack.elementAt(CUP$preKIFParser$top-0)).right, RESULT); } return CUP$preKIFParser$result; /* . . . . . .*/ default: throw new Exception( "Invalid action number found in internal parse table"); } } }