//---------------------------------------------------- // The following code was generated by CUP v0.10k // Tue Sep 12 10:07:39 VET 2006 //---------------------------------------------------- import java_cup.runtime.*; import java.util.*; import java.lang.*; import java.io.*; /** CUP v0.10k generated parser. * @version Tue Sep 12 10:07:39 VET 2006 */ public class parser extends java_cup.runtime.lr_parser { /** Default constructor. */ public parser() {super();} /** Constructor which sets the default scanner. */ public parser(java_cup.runtime.Scanner s) {super(s);} /** Production table. */ protected static final short _production_table[][] = unpackFromStrings(new String[] { "\000\013\000\002\002\004\000\002\003\003\000\002\003" + "\004\000\002\006\005\000\002\004\003\000\002\004\005" + "\000\002\007\006\000\002\005\003\000\002\005\005\000" + "\002\010\003\000\002\010\003" }); /** Access to production table. */ public short[][] production_table() {return _production_table;} /** Parse-action table. */ protected static final short[][] _action_table = unpackFromStrings(new String[] { "\000\024\000\004\006\005\001\002\000\006\002\026\006" + "\005\001\002\000\004\007\015\001\002\000\006\002\000" + "\006\000\001\002\000\004\011\010\001\002\000\004\006" + "\005\001\002\000\010\002\ufffd\006\ufffd\012\ufffd\001\002" + "\000\010\002\ufffe\006\ufffe\012\013\001\002\000\004\006" + "\005\001\002\000\010\002\ufffc\006\ufffc\012\ufffc\001\002" + "\000\006\004\020\005\021\001\002\000\006\010\ufffa\012" + "\ufffa\001\002\000\006\010\023\012\022\001\002\000\006" + "\010\ufff8\012\ufff8\001\002\000\006\010\ufff7\012\ufff7\001" + "\002\000\006\004\020\005\021\001\002\000\012\002\ufffb" + "\006\ufffb\011\ufffb\012\ufffb\001\002\000\006\010\ufff9\012" + "\ufff9\001\002\000\006\002\uffff\006\uffff\001\002\000\004" + "\002\001\001\002" }); /** Access to parse-action table. */ public short[][] action_table() {return _action_table;} /** <code>reduce_goto</code> table. */ protected static final short[][] _reduce_table = unpackFromStrings(new String[] { "\000\024\000\010\003\003\006\005\007\006\001\001\000" + "\006\006\024\007\006\001\001\000\002\001\001\000\002" + "\001\001\000\002\001\001\000\006\004\011\007\010\001" + "\001\000\002\001\001\000\002\001\001\000\004\007\013" + "\001\001\000\002\001\001\000\006\005\016\010\015\001" + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + "\000\002\001\001\000\004\010\023\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. */ 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;} /** User initialization code. */ public void user_init() throws java.lang.Exception { lex=new Yylex(System.in); } /** Scan to get the next Symbol. */ public java_cup.runtime.Symbol scan() throws java.lang.Exception { return lex.next_token(); } public void syntax_error(Symbol cur_token) { String linea = obtText(); report_error("Error de Sintaxis en la linea "+obtLine()+": "+ linea,cur_token); } public void unrecovered_syntax_error(Symbol cur_token){ report_error("Error irrecuperable. No se pudo generar el migrador.",cur_token); } public int obtLine(){ return lex.obtYyline(); } public int obtChar(){ return lex.obtYychar(); } public String obtText(){ return lex.obtYytext(); } Yylex lex; } /** Cup generated class to encapsulate user supplied action code.*/ class CUP$parser$actions { 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 10: // ITEM ::= ctte { Argument RESULT = null; int cleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; int cright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; String c = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; RESULT = new Argument(c); CUP$parser$result = new java_cup.runtime.Symbol(6/*ITEM*/, ((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 9: // ITEM ::= var { Argument RESULT = null; int vleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; int vright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; String v = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; RESULT = new Argument(v); CUP$parser$result = new java_cup.runtime.Symbol(6/*ITEM*/, ((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 8: // LIST ::= LIST coma ITEM { Vector RESULT = null; int lleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; int lright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; Vector l = (Vector)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; int aleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; int aright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; Argument a = (Argument)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; l.add(a); RESULT = l; CUP$parser$result = new java_cup.runtime.Symbol(3/*LIST*/, ((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 7: // LIST ::= ITEM { Vector RESULT = null; int aleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; int aright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; Argument a = (Argument)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; Vector l = new Vector(); l.add(a); RESULT = l; CUP$parser$result = new java_cup.runtime.Symbol(3/*LIST*/, ((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 6: // SO ::= nomb oparen LIST cparen { Subgoal RESULT = null; int nleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left; int nright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).right; String n = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value; int lleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; int lright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; Vector l = (Vector)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; RESULT = new Subgoal(n,l); CUP$parser$result = new java_cup.runtime.Symbol(5/*SO*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 5: // CUERPO ::= CUERPO coma SO { Vector RESULT = null; int lleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; int lright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; Vector l = (Vector)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; int aleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; int aright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; Subgoal a = (Subgoal)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; l.add(a); RESULT = l; CUP$parser$result = new java_cup.runtime.Symbol(2/*CUERPO*/, ((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 4: // CUERPO ::= SO { Vector RESULT = null; int aleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; int aright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; Subgoal a = (Subgoal)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; Vector l = new Vector(); l.add(a); RESULT = l; CUP$parser$result = new java_cup.runtime.Symbol(2/*CUERPO*/, ((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 3: // CQ ::= SO imp CUERPO { Query RESULT = null; int hleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; int hright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; Subgoal h = (Subgoal)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; int cleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; int cright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; Vector c = (Vector)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; RESULT = new Query(h.getName(), h, c); CUP$parser$result = new java_cup.runtime.Symbol(4/*CQ*/, ((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 2: // EXPERIMENTO ::= EXPERIMENTO CQ { Vector RESULT = null; int lleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; int lright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; Vector l = (Vector)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; int aleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; int aright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; Query a = (Query)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; l.add(a); RESULT = l; CUP$parser$result = new java_cup.runtime.Symbol(1/*EXPERIMENTO*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 1: // EXPERIMENTO ::= CQ { Vector RESULT = null; int aleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; int aright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; Query a = (Query)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; Vector l = new Vector(); l.add(a); RESULT = l; CUP$parser$result = new java_cup.runtime.Symbol(1/*EXPERIMENTO*/, ((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 0: // $START ::= EXPERIMENTO EOF { Object RESULT = null; int start_valleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; int start_valright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; Vector start_val = (Vector)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; RESULT = start_val; CUP$parser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } /* ACCEPT */ CUP$parser$parser.done_parsing(); return CUP$parser$result; /* . . . . . .*/ default: throw new Exception( "Invalid action number found in internal parse table"); } } }