/** Method with the actual generated action code. */ public TUVienna.CS_CUP.Runtime.Symbol CUP_TinyParser_do_action( int CUP_TinyParser_act_num, TUVienna.CS_CUP.Runtime.lr_parser CUP_TinyParser_parser, System.Collections.Stack xstack1, int CUP_TinyParser_top) { /* Symbol object for return from actions */ mStack CUP_TinyParser_stack = new mStack(xstack1); TUVienna.CS_CUP.Runtime.Symbol CUP_TinyParser_result; /* select the action based on the action number */ switch (CUP_TinyParser_act_num) { /*. . . . . . . . . . . . . . . . . . . .*/ case 30: // factor ::= error { Expresion RESULT = null; CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(13 /*factor*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 29: // factor ::= IDENTIFICADOR { Expresion RESULT = null; SimboloAbstracto id = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = new Variable(id, id.Linea, id.Columna); CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(13 /*factor*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 28: // factor ::= LIT_ENTERO { Expresion RESULT = null; SimboloAbstracto val = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = new NumeroEntero(val, val.Linea, val.Columna); CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(13 /*factor*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 27: // factor ::= PARENT_IZQ exp PARENT_DER { Expresion RESULT = null; Expresion e = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value; RESULT = e; CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(13 /*factor*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 26: // term ::= factor { Expresion RESULT = null; Expresion e = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = e; CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(12 /*term*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 25: // term ::= term DIVISION factor { Expresion RESULT = null; Expresion e1 = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 2)).value; SimboloAbstracto d = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value; Expresion e2 = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = new Division(e1, e2, d.Linea, d.Columna); CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(12 /*term*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 24: // term ::= term MULTIPLICACION factor { Expresion RESULT = null; Expresion e1 = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 2)).value; SimboloAbstracto m = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value; Expresion e2 = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = new Multiplicacion(e1, e2, m.Linea, m.Columna); CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(12 /*term*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 23: // exp_simple ::= term { Expresion RESULT = null; Expresion e = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = e; CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(11 /*exp_simple*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 22: // exp_simple ::= exp_simple RESTA term { Expresion RESULT = null; Expresion e1 = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 2)).value; SimboloAbstracto r = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value; Expresion e2 = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = new Resta(e1, e2, r.Linea, r.Columna); CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(11 /*exp_simple*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 21: // exp_simple ::= exp_simple SUMA term { Expresion RESULT = null; Expresion e1 = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 2)).value; SimboloAbstracto s = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value; Expresion e2 = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = new Suma(e1, e2, s.Linea, s.Columna); CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(11 /*exp_simple*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 20: // exp ::= exp_simple { Expresion RESULT = null; Expresion e = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = e; CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(10 /*exp*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 19: // exp ::= exp_simple IGUAL exp_simple { Expresion RESULT = null; Expresion e1 = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 2)).value; SimboloAbstracto i = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value; Expresion e2 = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = new Igual(e1, e2, i.Linea, i.Columna); CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(10 /*exp*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 18: // exp ::= exp_simple MENOR exp_simple { Expresion RESULT = null; Expresion e1 = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 2)).value; SimboloAbstracto m = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value; Expresion e2 = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = new Menor(e1, e2, m.Linea, m.Columna); CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(10 /*exp*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 17: // args ::= args COMA exp { ListaParametros RESULT = null; ListaParametros p = (ListaParametros)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 2)).value; Expresion e = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; p.agregarElemento(e); RESULT = p; CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(9 /*args*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 16: // args ::= exp { ListaParametros RESULT = null; Expresion e = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = new ListaParametros(); RESULT.agregarElemento(e); CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(9 /*args*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 15: // opt_args ::= { ListaParametros RESULT = null; RESULT = new ListaParametros(); CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(8 /*opt_args*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 14: // opt_args ::= args { ListaParametros RESULT = null; ListaParametros p = (ListaParametros)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = p; CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(8 /*opt_args*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 13: // fuction_call ::= IDENTIFICADOR opt_args { Sentencia RESULT = null; SimboloAbstracto id = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value; ListaParametros p = (ListaParametros)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = new LLamadaFuncion(id, p, id.Linea, id.Columna); CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(7 /*fuction_call*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 12: // sent_assign ::= IDENTIFICADOR ASIGNACION exp { Sentencia RESULT = null; SimboloAbstracto id = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 2)).value; SimboloAbstracto a = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value; Expresion e = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = new Asignacion(new Variable(id, id.Linea, id.Columna), e, a.Linea, a.Columna); CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(6 /*sent_assign*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 11: // sent_repeat ::= REPITA secuencia_sent HASTA exp { Sentencia RESULT = null; SimboloAbstracto r = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 3)).value; ListaSentencia s = (ListaSentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 2)).value; Expresion c = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = new RepitaHasta(c, s, r.Linea, r.Columna); CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(5 /*sent_repeat*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 10: // sent_if ::= SI exp ENTONCES secuencia_sent SINO secuencia_sent FIN { Sentencia RESULT = null; SimboloAbstracto s = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 6)).value; Expresion c = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 5)).value; ListaSentencia en = (ListaSentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 3)).value; ListaSentencia sn = (ListaSentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value; RESULT = new Condicional(c, en, sn, s.Linea, s.Columna); CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(4 /*sent_if*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 9: // sent_if ::= SI exp ENTONCES secuencia_sent FIN { Sentencia RESULT = null; SimboloAbstracto s = (SimboloAbstracto)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 4)).value; Expresion c = (Expresion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 3)).value; ListaSentencia en = (ListaSentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value; RESULT = new Condicional(c, en, null, s.Linea, s.Columna); CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(4 /*sent_if*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 8: // sent ::= error { Sentencia RESULT = null; CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(3 /*sent*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 7: // sent ::= fuction_call { Sentencia RESULT = null; Sentencia s = (Sentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = s; CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(3 /*sent*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 6: // sent ::= sent_assign { Sentencia RESULT = null; Sentencia s = (Sentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = s; CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(3 /*sent*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 5: // sent ::= sent_repeat { Sentencia RESULT = null; Sentencia s = (Sentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = s; CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(3 /*sent*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 4: // sent ::= sent_if { Sentencia RESULT = null; Sentencia s = (Sentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = s; CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(3 /*sent*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 3: // secuencia_sent ::= sent { ListaSentencia RESULT = null; Sentencia s = (Sentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = new ListaSentencia(); RESULT.agregarElemento(s); CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(2 /*secuencia_sent*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 2: // secuencia_sent ::= secuencia_sent PUNTO_Y_COMA sent { ListaSentencia RESULT = null; ListaSentencia sc = (ListaSentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 2)).value; Sentencia s = (Sentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; sc.agregarElemento(s); RESULT = sc; CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(2 /*secuencia_sent*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 1: // programa ::= secuencia_sent { Programa RESULT = null; ListaSentencia sc = (ListaSentencia)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 0)).value; RESULT = new Programa(sc, 1, 0); CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(1 /*programa*/, RESULT); } return(CUP_TinyParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 0: // $START ::= programa EOF { object RESULT = null; Programa start_val = (Programa)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyParser_stack.elementAt(CUP_TinyParser_top - 1)).value; RESULT = start_val; CUP_TinyParser_result = new TUVienna.CS_CUP.Runtime.Symbol(0 /*$START*/, RESULT); } /* ACCEPT */ CUP_TinyParser_parser.done_parsing(); return(CUP_TinyParser_result); /* . . . . . .*/ default: throw new System.Exception( "Invalid action number found in internal parse table"); } }
/** Method with the actual generated action code. */ public Symbol CUP_parser_do_action( int CUP_parser_act_num, lr_parser CUP_parser_parser, Stack CUP_parser_stack1, int CUP_parser_top) { /* Symbol object for return from actions */ Symbol CUP_parser_result; mStack CUP_parser_stack= new mStack(CUP_parser_stack1); /* select the action based on the action number */ switch (CUP_parser_act_num) { /*. . . . . . . . . . . . . . . . . . . .*/ case 106: // empty ::= { object RESULT = null; CUP_parser_result = new Symbol(29/*empty*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 105: // opt_semi ::= SEMI { object RESULT = null; CUP_parser_result = new Symbol(7/*opt_semi*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 104: // opt_semi ::= { object RESULT = null; CUP_parser_result = new Symbol(7/*opt_semi*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 103: // non_terminal ::= NONTERMINAL { object RESULT = null; CUP_parser_result = new Symbol(8/*non_terminal*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 102: // non_terminal ::= NON TERMINAL { object RESULT = null; CUP_parser_result = new Symbol(8/*non_terminal*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 101: // robust_id ::= error { string RESULT = null; lexer.emit_error("Illegal use of reserved word"); RESULT="ILLEGAL"; CUP_parser_result = new Symbol(42/*robust_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 100: // robust_id ::= NONASSOC { string RESULT = null; RESULT = "nonassoc"; CUP_parser_result = new Symbol(42/*robust_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 99: // robust_id ::= RIGHT { string RESULT = null; RESULT = "right"; CUP_parser_result = new Symbol(42/*robust_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 98: // robust_id ::= LEFT { string RESULT = null; RESULT = "left"; CUP_parser_result = new Symbol(42/*robust_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 97: // robust_id ::= PRECEDENCE { string RESULT = null; RESULT = "precedence"; CUP_parser_result = new Symbol(42/*robust_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 96: // robust_id ::= START { string RESULT = null; RESULT = "start"; CUP_parser_result = new Symbol(42/*robust_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 95: // robust_id ::= WITH { string RESULT = null; RESULT = "with"; CUP_parser_result = new Symbol(42/*robust_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 94: // robust_id ::= SCAN { string RESULT = null; RESULT = "scan"; CUP_parser_result = new Symbol(42/*robust_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 93: // robust_id ::= INIT { string RESULT = null; RESULT = "init"; CUP_parser_result = new Symbol(42/*robust_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 92: // robust_id ::= NONTERMINAL { string RESULT = null; RESULT = "nonterminal"; CUP_parser_result = new Symbol(42/*robust_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 91: // robust_id ::= NON { string RESULT = null; RESULT = "non"; CUP_parser_result = new Symbol(42/*robust_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 90: // robust_id ::= TERMINAL { string RESULT = null; RESULT = "terminal"; CUP_parser_result = new Symbol(42/*robust_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 89: // robust_id ::= PARSER { string RESULT = null; RESULT = "parser"; CUP_parser_result = new Symbol(42/*robust_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 88: // robust_id ::= ACTION { string RESULT = null; RESULT = "action"; CUP_parser_result = new Symbol(42/*robust_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 87: // robust_id ::= CODE { string RESULT = null; RESULT = "code"; CUP_parser_result = new Symbol(42/*robust_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 86: // robust_id ::= ID { string RESULT = null; int the_idleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left; int the_idright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right; string the_id = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value; RESULT = the_id; CUP_parser_result = new Symbol(42/*robust_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 85: // label_id ::= robust_id { string RESULT = null; int the_idleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left; int the_idright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right; string the_id = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value; RESULT = the_id; CUP_parser_result = new Symbol(38/*label_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 84: // symbol_id ::= error { string RESULT = null; lexer.emit_error("Illegal use of reserved word"); RESULT="ILLEGAL"; CUP_parser_result = new Symbol(37/*symbol_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 83: // symbol_id ::= ID { string RESULT = null; int the_idleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left; int the_idright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right; string the_id = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value; RESULT = the_id; CUP_parser_result = new Symbol(37/*symbol_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 82: // nt_id ::= error { string RESULT = null; lexer.emit_error("Illegal use of reserved word"); RESULT="ILLEGAL"; CUP_parser_result = new Symbol(36/*nt_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 81: // nt_id ::= ID { string RESULT = null; int the_idleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left; int the_idright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right; string the_id = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value; RESULT = the_id; CUP_parser_result = new Symbol(36/*nt_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 80: // new_non_term_id ::= ID { object RESULT = null; int non_term_idleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left; int non_term_idright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right; string non_term_id = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value; /* see if this non terminal has been declared before */ if (symbols[non_term_id] != null) { /* issue a message */ lexer.emit_error( "Symbol \"" + non_term_id + "\" has already been declared"); } else { if (multipart_name.Equals("")) { append_multipart("object"); } /* build the non terminal object */ non_terminal this_nt = new non_terminal(non_term_id, multipart_name); /* put it in the non_terms table */ non_terms.Add(non_term_id, this_nt); /* build a production_part and put it in the symbols table */ symbols.Add(non_term_id, new symbol_part(this_nt)); } CUP_parser_result = new Symbol(26/*new_non_term_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 79: // new_term_id ::= ID { object RESULT = null; int term_idleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left; int term_idright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right; string term_id = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value; /* see if this terminal has been declared before */ if (symbols[term_id] != null) { /* issue a message */ lexer.emit_error("Symbol \"" + term_id + "\" has already been declared"); } else { /* if no type declared, declare one */ if (multipart_name.Equals("")) { append_multipart("object"); } /* build a production_part and put it in the table */ symbols.Add(term_id, new symbol_part(new terminal(term_id, multipart_name))); } CUP_parser_result = new Symbol(25/*new_term_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 78: // type_id ::= type_id LBRACK RBRACK { object RESULT = null; multipart_name = multipart_name+"[]"; CUP_parser_result = new Symbol(19/*type_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 77: // type_id ::= multipart_id { object RESULT = null; CUP_parser_result = new Symbol(19/*type_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 76: // import_id ::= multipart_id { object RESULT = null; CUP_parser_result = new Symbol(15/*import_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 75: // import_id ::= multipart_id DOT STAR { object RESULT = null; append_multipart("*"); CUP_parser_result = new Symbol(15/*import_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 74: // multipart_id ::= robust_id { object RESULT = null; int an_idleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left; int an_idright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right; string an_id = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value; append_multipart(an_id); CUP_parser_result = new Symbol(13/*multipart_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 73: // multipart_id ::= multipart_id DOT robust_id { object RESULT = null; int another_idleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left; int another_idright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right; string another_id = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value; append_multipart(another_id); CUP_parser_result = new Symbol(13/*multipart_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 72: // opt_label ::= empty { string RESULT = null; RESULT = null; CUP_parser_result = new Symbol(39/*opt_label*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 71: // opt_label ::= COLON label_id { string RESULT = null; int labidleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left; int labidright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right; string labid = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value; RESULT = labid; CUP_parser_result = new Symbol(39/*opt_label*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 70: // prod_part ::= CODE_string { object RESULT = null; int code_strleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left; int code_strright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right; string code_str = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value; /* add a new production part */ add_rhs_part(new action_part(code_str)); CUP_parser_result = new Symbol(24/*prod_part*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 69: // prod_part ::= symbol_id opt_label { object RESULT = null; int symidleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left; int symidright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).right; string symid = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value; int labidleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left; int labidright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right; string labid = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value; /* try to look up the id */ production_part symb = (production_part)symbols[symid]; /* if that fails, symbol is undeclared */ if (symb == null) { if (lexer.error_count == 0) lexer.emit_error("Symbol \"" + symid + "\" has not been declared"); } else { /* add a labeled production part */ add_rhs_part(add_lab(symb, labid)); } CUP_parser_result = new Symbol(24/*prod_part*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 68: // prod_part_list ::= empty { object RESULT = null; CUP_parser_result = new Symbol(23/*prod_part_list*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 67: // prod_part_list ::= prod_part_list prod_part { object RESULT = null; CUP_parser_result = new Symbol(23/*prod_part_list*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 66: // rhs ::= prod_part_list { object RESULT = null; if (lhs_nt != null) { /* build the production */ production p = new production(lhs_nt, rhs_parts, rhs_pos); /* if we have no start non-terminal declared and this is the first production, make its lhs nt the start_nt and build a special start production for it. */ if (start_nt == null) { start_nt = lhs_nt; /* build a special start production */ new_rhs(); add_rhs_part(add_lab(new symbol_part(start_nt),"start_val")); add_rhs_part(new symbol_part(terminal.EOF)); add_rhs_part(new action_part("RESULT = start_val;")); emit.start_production = new production(non_terminal.START_nt, rhs_parts, rhs_pos); new_rhs(); } } /* reset the rhs accumulation in any case */ new_rhs(); CUP_parser_result = new Symbol(28/*rhs*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 65: // rhs ::= prod_part_list PERCENT_PREC term_id { object RESULT = null; int term_nameleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left; int term_nameright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right; string term_name = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value; symbol sym = null; if (lhs_nt != null) { /* Find the precedence symbol */ if (term_name == null) { System.Console.Error.WriteLine("No terminal for contextual precedence"); sym = null; } else { sym = ((symbol_part)symbols[term_name]).the_symbol(); } /* build the production */ production p; if ((sym!=null) && (sym.GetType()==typeof(terminal))) { p = new production(lhs_nt, rhs_parts, rhs_pos, ((terminal)sym).precedence_num(), ((terminal)sym).precedence_side()); ((symbol_part)symbols[term_name]).the_symbol().note_use(); } else { System.Console.Error.WriteLine("Invalid terminal " + term_name + " for contextual precedence assignment"); p = new production(lhs_nt, rhs_parts, rhs_pos); } /* if we have no start non-terminal declared and this is the first production, make its lhs nt the start_nt and build a special start production for it. */ if (start_nt == null) { start_nt = lhs_nt; /* build a special start production */ new_rhs(); add_rhs_part(add_lab(new symbol_part(start_nt),"start_val")); add_rhs_part(new symbol_part(terminal.EOF)); add_rhs_part(new action_part("RESULT = start_val;")); if ((sym!=null) && (sym.GetType()==typeof(terminal))) { emit.start_production = new production(non_terminal.START_nt, rhs_parts, rhs_pos, ((terminal)sym).precedence_num(), ((terminal)sym).precedence_side()); } else { emit.start_production = new production(non_terminal.START_nt, rhs_parts, rhs_pos); } new_rhs(); } } /* reset the rhs accumulation in any case */ new_rhs(); CUP_parser_result = new Symbol(28/*rhs*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 64: // rhs_list ::= rhs { object RESULT = null; CUP_parser_result = new Symbol(27/*rhs_list*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 63: // rhs_list ::= rhs_list BAR rhs { object RESULT = null; CUP_parser_result = new Symbol(27/*rhs_list*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 62: // production ::= error NT$13 SEMI { object RESULT = null; // propagate RESULT from NT$13 if ( ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value != null ) RESULT = (object) ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value; CUP_parser_result = new Symbol(22/*production*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 61: // NT$13 ::= { object RESULT = null; lexer.emit_error("Syntax Error"); CUP_parser_result = new Symbol(56/*NT$13*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 60: // production ::= nt_id NT$11 COLON_COLON_EQUALS NT$12 rhs_list SEMI { object RESULT = null; // propagate RESULT from NT$11 if ( ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-4)).value != null ) RESULT = (object) ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-4)).value; // propagate RESULT from NT$12 if ( ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value != null ) RESULT = (object) ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value; int lhs_idleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-5)).left; int lhs_idright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-5)).right; string lhs_id = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-5)).value; CUP_parser_result = new Symbol(22/*production*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-5)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 59: // NT$12 ::= { object RESULT = null; int lhs_idleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left; int lhs_idright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right; string lhs_id = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value; CUP_parser_result = new Symbol(55/*NT$12*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 58: // NT$11 ::= { object RESULT = null; int lhs_idleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left; int lhs_idright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right; string lhs_id = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value; /* lookup the lhs nt */ lhs_nt = (non_terminal)non_terms[lhs_id]; /* if it wasn't declared, emit a message */ if (lhs_nt == null) { if (lexer.error_count == 0) lexer.emit_error("LHS non terminal \"" + lhs_id + "\" has not been declared"); } /* reset the rhs accumulation */ new_rhs(); CUP_parser_result = new Symbol(54/*NT$11*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 57: // production_list ::= production { object RESULT = null; CUP_parser_result = new Symbol(12/*production_list*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 56: // production_list ::= production_list production { object RESULT = null; CUP_parser_result = new Symbol(12/*production_list*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 55: // start_spec ::= empty { object RESULT = null; CUP_parser_result = new Symbol(11/*start_spec*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 54: // start_spec ::= START WITH nt_id NT$10 SEMI { object RESULT = null; // propagate RESULT from NT$10 if ( ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value != null ) RESULT = (object) ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value; int start_nameleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left; int start_nameright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).right; string start_name = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value; CUP_parser_result = new Symbol(11/*start_spec*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-4)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 53: // NT$10 ::= { object RESULT = null; int start_nameleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left; int start_nameright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right; string start_name = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value; /* verify that the name has been declared as a non terminal */ non_terminal nt = (non_terminal)non_terms[start_name]; if (nt == null) { lexer.emit_error( "Start non terminal \"" + start_name + "\" has not been declared"); } else { /* remember the non-terminal for later */ start_nt = nt; /* build a special start production */ new_rhs(); add_rhs_part(add_lab(new symbol_part(start_nt), "start_val")); add_rhs_part(new symbol_part(terminal.EOF)); add_rhs_part(new action_part("RESULT = start_val;")); emit.start_production = new production(non_terminal.START_nt, rhs_parts, rhs_pos); new_rhs(); } CUP_parser_result = new Symbol(53/*NT$10*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 52: // term_id ::= symbol_id { string RESULT = null; int symleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left; int symright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right; string sym = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value; /* check that the symbol_id is a terminal */ if (symbols[sym] == null) { /* issue a message */ lexer.emit_error("Terminal \"" + sym + "\" has not been declared"); } RESULT = sym; CUP_parser_result = new Symbol(41/*term_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 51: // terminal_id ::= term_id { string RESULT = null; int symleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left; int symright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right; string sym = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-0)).value; add_precedence(sym); RESULT = sym; CUP_parser_result = new Symbol(40/*terminal_id*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 50: // terminal_list ::= terminal_id { object RESULT = null; CUP_parser_result = new Symbol(32/*terminal_list*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 49: // terminal_list ::= terminal_list COMMA terminal_id { object RESULT = null; CUP_parser_result = new Symbol(32/*terminal_list*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 48: // preced ::= PRECEDENCE NONASSOC NT$9 terminal_list SEMI { object RESULT = null; // propagate RESULT from NT$9 if ( ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value != null ) RESULT = (object) ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value; CUP_parser_result = new Symbol(31/*preced*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-4)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 47: // NT$9 ::= { object RESULT = null; update_precedence(assoc.nonassoc); CUP_parser_result = new Symbol(52/*NT$9*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 46: // preced ::= PRECEDENCE RIGHT NT$8 terminal_list SEMI { object RESULT = null; // propagate RESULT from NT$8 if ( ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value != null ) RESULT = (object) ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value; CUP_parser_result = new Symbol(31/*preced*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-4)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 45: // NT$8 ::= { object RESULT = null; update_precedence(assoc.right); CUP_parser_result = new Symbol(51/*NT$8*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 44: // preced ::= PRECEDENCE LEFT NT$7 terminal_list SEMI { object RESULT = null; // propagate RESULT from NT$7 if ( ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value != null ) RESULT = (object) ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-2)).value; CUP_parser_result = new Symbol(31/*preced*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-4)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 43: // NT$7 ::= { object RESULT = null; update_precedence(assoc.left); CUP_parser_result = new Symbol(50/*NT$7*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 42: // precedence_l ::= preced { object RESULT = null; CUP_parser_result = new Symbol(33/*precedence_l*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 41: // precedence_l ::= precedence_l preced { object RESULT = null; CUP_parser_result = new Symbol(33/*precedence_l*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 40: // precedence_list ::= empty { object RESULT = null; CUP_parser_result = new Symbol(30/*precedence_list*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 39: // precedence_list ::= precedence_l { object RESULT = null; CUP_parser_result = new Symbol(30/*precedence_list*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 38: // non_term_name_list ::= new_non_term_id { object RESULT = null; CUP_parser_result = new Symbol(21/*non_term_name_list*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 37: // non_term_name_list ::= non_term_name_list COMMA new_non_term_id { object RESULT = null; CUP_parser_result = new Symbol(21/*non_term_name_list*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 36: // term_name_list ::= new_term_id { object RESULT = null; CUP_parser_result = new Symbol(20/*term_name_list*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 35: // term_name_list ::= term_name_list COMMA new_term_id { object RESULT = null; CUP_parser_result = new Symbol(20/*term_name_list*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 34: // declares_non_term ::= non_term_name_list NT$6 SEMI { object RESULT = null; // propagate RESULT from NT$6 if ( ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value != null ) RESULT = (object) ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value; CUP_parser_result = new Symbol(35/*declares_non_term*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 33: // NT$6 ::= { object RESULT = null; /* reset the accumulated multipart name */ multipart_name = ""; CUP_parser_result = new Symbol(49/*NT$6*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 32: // declares_term ::= term_name_list NT$5 SEMI { object RESULT = null; // propagate RESULT from NT$5 if ( ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value != null ) RESULT = (object) ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value; CUP_parser_result = new Symbol(34/*declares_term*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 31: // NT$5 ::= { object RESULT = null; /* reset the accumulated multipart name */ multipart_name = ""; CUP_parser_result = new Symbol(48/*NT$5*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 30: // symbol ::= non_terminal error NT$4 SEMI { object RESULT = null; // propagate RESULT from NT$4 if ( ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value != null ) RESULT = (object) ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value; CUP_parser_result = new Symbol(18/*symbol*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-3)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 29: // NT$4 ::= { object RESULT = null; /* reset the accumulated multipart name */ multipart_name = ""; CUP_parser_result = new Symbol(47/*NT$4*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 28: // symbol ::= TERMINAL error NT$3 SEMI { object RESULT = null; // propagate RESULT from NT$3 if ( ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value != null ) RESULT = (object) ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value; CUP_parser_result = new Symbol(18/*symbol*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-3)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 27: // NT$3 ::= { object RESULT = null; /* reset the accumulated multipart name */ multipart_name = ""; CUP_parser_result = new Symbol(46/*NT$3*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 26: // symbol ::= non_terminal declares_non_term { object RESULT = null; CUP_parser_result = new Symbol(18/*symbol*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 25: // symbol ::= non_terminal type_id declares_non_term { object RESULT = null; CUP_parser_result = new Symbol(18/*symbol*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 24: // symbol ::= TERMINAL declares_term { object RESULT = null; CUP_parser_result = new Symbol(18/*symbol*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 23: // symbol ::= TERMINAL type_id declares_term { object RESULT = null; CUP_parser_result = new Symbol(18/*symbol*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-2)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 22: // symbol_list ::= symbol { object RESULT = null; CUP_parser_result = new Symbol(10/*symbol_list*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 21: // symbol_list ::= symbol_list symbol { object RESULT = null; CUP_parser_result = new Symbol(10/*symbol_list*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 20: // scan_code ::= SCAN WITH CODE_string opt_semi { object RESULT = null; int user_codeleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left; int user_coderight = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).right; string user_code = ((string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value); if (emit.scan_code!=null) lexer.emit_error("Redundant scan code (skipping)"); else /* save the user code */ emit.scan_code = user_code; CUP_parser_result = new Symbol(17/*scan_code*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-3)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 19: // init_code ::= INIT WITH CODE_string opt_semi { object RESULT = null; int user_codeleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left; int user_coderight = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).right; string user_code = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value; if (emit.init_code!=null) lexer.emit_error("Redundant init code (skipping)"); else /* save the user code */ emit.init_code = user_code; CUP_parser_result = new Symbol(16/*init_code*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-3)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 18: // parser_code_part ::= PARSER CODE CODE_string opt_semi { object RESULT = null; int user_codeleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left; int user_coderight = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).right; string user_code = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value; if (emit.parser_code!=null) lexer.emit_error("Redundant parser code (skipping)"); else /* save the user included code string */ emit.parser_code = user_code; CUP_parser_result = new Symbol(9/*parser_code_part*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-3)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 17: // action_code_part ::= ACTION CODE CODE_string opt_semi { object RESULT = null; int user_codeleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left; int user_coderight = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).right; string user_code = (string)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value; if (emit.action_code!=null) lexer.emit_error("Redundant action code (skipping)"); else /* save the user included code string */ emit.action_code = user_code; CUP_parser_result = new Symbol(4/*action_code_part*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-3)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 16: // code_parts ::= code_parts code_part { object RESULT = null; CUP_parser_result = new Symbol(5/*code_parts*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 15: // code_parts ::= { object RESULT = null; CUP_parser_result = new Symbol(5/*code_parts*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 14: // code_part ::= scan_code { object RESULT = null; CUP_parser_result = new Symbol(6/*code_part*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 13: // code_part ::= init_code { object RESULT = null; CUP_parser_result = new Symbol(6/*code_part*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 12: // code_part ::= parser_code_part { object RESULT = null; CUP_parser_result = new Symbol(6/*code_part*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 11: // code_part ::= action_code_part { object RESULT = null; CUP_parser_result = new Symbol(6/*code_part*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 10: // import_spec ::= IMPORT import_id NT$2 SEMI { object RESULT = null; // propagate RESULT from NT$2 if ( ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value != null ) RESULT = (object) ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value; CUP_parser_result = new Symbol(14/*import_spec*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-3)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 9: // NT$2 ::= { object RESULT = null; /* save this import on the imports list */ emit.import_list.Push(multipart_name); /* reset the accumulated multipart name */ multipart_name = ""; CUP_parser_result = new Symbol(45/*NT$2*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 8: // import_list ::= empty { object RESULT = null; CUP_parser_result = new Symbol(3/*import_list*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 7: // import_list ::= import_list import_spec { object RESULT = null; CUP_parser_result = new Symbol(3/*import_list*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 6: // package_spec ::= empty { object RESULT = null; CUP_parser_result = new Symbol(2/*package_spec*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 5: // package_spec ::= PACKAGE multipart_id NT$1 SEMI { object RESULT = null; // propagate RESULT from NT$1 if ( ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value != null ) RESULT = (object) ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value; CUP_parser_result = new Symbol(2/*package_spec*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-3)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 4: // NT$1 ::= { object RESULT = null; /* save the package name */ emit.package_name = multipart_name; /* reset the accumulated multipart name */ multipart_name = ""; CUP_parser_result = new Symbol(44/*NT$1*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 3: // spec ::= error symbol_list precedence_list start_spec production_list { object RESULT = null; CUP_parser_result = new Symbol(1/*spec*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-4)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 2: // spec ::= NT$0 package_spec import_list code_parts symbol_list precedence_list start_spec production_list { object RESULT = null; // propagate RESULT from NT$0 if ( ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-7)).value != null ) RESULT = (object) ((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-7)).value; CUP_parser_result = new Symbol(1/*spec*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-7)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 1: // NT$0 ::= { object RESULT = null; /* declare "error" as a terminal */ symbols.Add("error", new symbol_part(terminal.error)); /* declare start non terminal */ non_terms.Add("$START", non_terminal.START_nt); CUP_parser_result = new Symbol(43/*NT$0*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } return CUP_parser_result; /*. . . . . . . . . . . . . . . . . . . .*/ case 0: // $START ::= spec EOF { object RESULT = null; int start_valleft = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left; int start_valright = ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).right; object start_val = (object)((Symbol) CUP_parser_stack.elementAt(CUP_parser_top-1)).value; RESULT = start_val; CUP_parser_result = new Symbol(0/*$START*/, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-1)).left, ((Symbol)CUP_parser_stack.elementAt(CUP_parser_top-0)).right, RESULT); } /* ACCEPT */ CUP_parser_parser.done_parsing(); return CUP_parser_result; /* . . . . . .*/ default: throw new System.Exception( "Invalid action number found in internal parse table"); } }
/** Method with the actual generated action code. */ public TUVienna.CS_CUP.Runtime.Symbol CUP_TinyMachineParser_do_action( int CUP_TinyMachineParser_act_num, TUVienna.CS_CUP.Runtime.lr_parser CUP_TinyMachineParser_parser, System.Collections.Stack xstack1, int CUP_TinyMachineParser_top) { /* Symbol object for return from actions */ mStack CUP_TinyMachineParser_stack = new mStack(xstack1); TUVienna.CS_CUP.Runtime.Symbol CUP_TinyMachineParser_result; /* select the action based on the action number */ switch (CUP_TinyMachineParser_act_num) { /*. . . . . . . . . . . . . . . . . . . .*/ case 30: // argRO ::= ENTERO COMA ENTERO PARENT_IZQ ENTERO PARENT_DER { Operacion RESULT = null; Symbol r = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 5)).value; Symbol s = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 3)).value; Symbol t = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; RESULT = new Operacion(r, s, t); CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(7 /*argRO*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 29: // sentenciaRO ::= JNE argRO { Operacion RESULT = null; Symbol op = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; Operacion i = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; i.Opcode = op; RESULT = i; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(5 /*sentenciaRO*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 28: // sentenciaRO ::= JEQ argRO { Operacion RESULT = null; Symbol op = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; Operacion i = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; i.Opcode = op; RESULT = i; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(5 /*sentenciaRO*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 27: // sentenciaRO ::= JGT argRO { Operacion RESULT = null; Symbol op = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; Operacion i = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; i.Opcode = op; RESULT = i; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(5 /*sentenciaRO*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 26: // sentenciaRO ::= JGE argRO { Operacion RESULT = null; Symbol op = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; Operacion i = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; i.Opcode = op; RESULT = i; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(5 /*sentenciaRO*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 25: // sentenciaRO ::= JLE argRO { Operacion RESULT = null; Symbol op = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; Operacion i = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; i.Opcode = op; RESULT = i; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(5 /*sentenciaRO*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 24: // sentenciaRO ::= JLT argRO { Operacion RESULT = null; Symbol op = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; Operacion i = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; i.Opcode = op; RESULT = i; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(5 /*sentenciaRO*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 23: // sentenciaRO ::= ST argRO { Operacion RESULT = null; Symbol op = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; Operacion i = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; i.Opcode = op; RESULT = i; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(5 /*sentenciaRO*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 22: // sentenciaRO ::= LDC argRO { Operacion RESULT = null; Symbol op = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; Operacion i = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; i.Opcode = op; RESULT = i; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(5 /*sentenciaRO*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 21: // sentenciaRO ::= LDA argRO { Operacion RESULT = null; Symbol op = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; Operacion i = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; i.Opcode = op; RESULT = i; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(5 /*sentenciaRO*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 20: // sentenciaRO ::= LD argRO { Operacion RESULT = null; Symbol op = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; Operacion i = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; i.Opcode = op; RESULT = i; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(5 /*sentenciaRO*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 19: // argRM ::= ENTERO COMA ENTERO COMA ENTERO { Operacion RESULT = null; Symbol r = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 4)).value; Symbol s = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 2)).value; Symbol t = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; RESULT = new Operacion(r, s, t); CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(6 /*argRM*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 18: // sentenciaRM ::= DIV argRM { Operacion RESULT = null; Symbol op = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; Operacion i = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; i.Opcode = op; RESULT = i; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(4 /*sentenciaRM*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 17: // sentenciaRM ::= MUL argRM { Operacion RESULT = null; Symbol op = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; Operacion i = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; i.Opcode = op; RESULT = i; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(4 /*sentenciaRM*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 16: // sentenciaRM ::= SUB argRM { Operacion RESULT = null; Symbol op = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; Operacion i = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; i.Opcode = op; RESULT = i; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(4 /*sentenciaRM*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 15: // sentenciaRM ::= ADD argRM { Operacion RESULT = null; Symbol op = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; Operacion i = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; i.Opcode = op; RESULT = i; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(4 /*sentenciaRM*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 14: // sentenciaRM ::= OUT argRM { Operacion RESULT = null; Symbol op = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; Operacion i = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; i.Opcode = op; RESULT = i; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(4 /*sentenciaRM*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 13: // sentenciaRM ::= IN argRM { Operacion RESULT = null; Symbol op = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; Operacion i = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; i.Opcode = op; RESULT = i; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(4 /*sentenciaRM*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 12: // sentenciaRM ::= HALT argRM { Operacion RESULT = null; Symbol op = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; Operacion i = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; i.Opcode = op; RESULT = i; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(4 /*sentenciaRM*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 11: // fin_sent ::= { string RESULT = null; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(8 /*fin_sent*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 10: // fin_sent ::= COMENTARIO_LINEA { string RESULT = null; string c = (string)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; RESULT = c; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(8 /*fin_sent*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 9: // fin_sent ::= COMENTARIO_FIN { string RESULT = null; string c = (string)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; RESULT = c; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(8 /*fin_sent*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 8: // fin_sent ::= FIN_LINEA { string RESULT = null; RESULT = ""; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(8 /*fin_sent*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 7: // sent ::= ENTERO COLON sentenciaRO fin_sent { Operacion RESULT = null; Symbol l = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 3)).value; Operacion i = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; string c = (string)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; i.NumeroOp = (int)l.value; i.Comentario = c; RESULT = i; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(3 /*sent*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 6: // sent ::= ENTERO COLON sentenciaRM fin_sent { Operacion RESULT = null; Symbol l = (Symbol)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 3)).value; Operacion i = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; string c = (string)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; i.NumeroOp = (int)l.value; i.Comentario = c; RESULT = i; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(3 /*sent*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 5: // sent ::= COMENTARIO_LINEA { Operacion RESULT = null; RESULT = null; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(3 /*sent*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 4: // secuencia_sent ::= error { Programa RESULT = null; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(2 /*secuencia_sent*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 3: // secuencia_sent ::= sent { Programa RESULT = null; Operacion s = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; RESULT = new Programa(); if (s != null) { RESULT.Instrucciones[s.NumeroOp] = s; } CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(2 /*secuencia_sent*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 2: // secuencia_sent ::= secuencia_sent sent { Programa RESULT = null; Programa sc = (Programa)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; Operacion s = (Operacion)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; if (s != null) { sc.Instrucciones[s.NumeroOp] = s; } RESULT = sc; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(2 /*secuencia_sent*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 1: // programa ::= secuencia_sent { Programa RESULT = null; Programa sc = (Programa)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 0)).value; RESULT = sc; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(1 /*programa*/, RESULT); } return(CUP_TinyMachineParser_result); /*. . . . . . . . . . . . . . . . . . . .*/ case 0: // $START ::= programa EOF { object RESULT = null; Programa start_val = (Programa)((TUVienna.CS_CUP.Runtime.Symbol)CUP_TinyMachineParser_stack.elementAt(CUP_TinyMachineParser_top - 1)).value; RESULT = start_val; CUP_TinyMachineParser_result = new TUVienna.CS_CUP.Runtime.Symbol(0 /*$START*/, RESULT); } /* ACCEPT */ CUP_TinyMachineParser_parser.done_parsing(); return(CUP_TinyMachineParser_result); /* . . . . . .*/ default: throw new System.Exception( "Invalid action number found in internal parse table"); } }