public While WHILE(ParseTreeNode actual) { //WHILE.Rule = RESERV_WHILE + LOGIC_EXPRESION + RESERV_DO + INSTRUCTIONS_BODY; var condition = (new ExpressionAST()).getExpresion(actual.ChildNodes[1]); int row = actual.ChildNodes[0].Token.Location.Line; int col = actual.ChildNodes[0].Token.Location.Column; InstructionAST instructionAST = new InstructionAST(); LinkedList <Instruction> lista_instrucciones = instructionAST.INSTRUCTIONS_BODY(actual.ChildNodes[3]); return(new While(condition, new Sentence(lista_instrucciones), row, col)); }
public Repeat REPEAT_UNTIL(ParseTreeNode actual) { //REPEAT_UNTIL.Rule = RESERV_REPEAT + INSTRUCTIONS + RESERV_UNTIL + LOGIC_EXPRESION + PUNTO_COMA; //SE OBTIENEN LOS VALORES var instrucciones = actual.ChildNodes[1]; var condicion = (new ExpressionAST()).getExpresion(actual.ChildNodes[3]); var row = actual.ChildNodes[0].Token.Location.Line; var col = actual.ChildNodes[0].Token.Location.Column; InstructionAST instructionAST = new InstructionAST(); //OBTENGO LA LISTA DE INSTRUCCIONES LinkedList <Instruction> lista_instrucciones = instructionAST.ISTRUCCIONES(instrucciones); //RETORNO EL NUEVO REPEAT-UTIL return(new Repeat(condicion, new Sentence(lista_instrucciones), row, col)); }