@Override public List<MLCommand> getML() { if (!simpE) { List<MLCommand> res = new ArrayList<>(); if (!e.simpleExpression()) { res.addAll(e.getML()); } res.add(new StackPushML(Memory.Stack, e.expr())); if (!e2.simpleExpression()) { res.addAll(e2.getML()); } res.add(new StackPushML(Memory.Stack, e2.expr())); res.add(new StackPopML(Memory.Stack)); res.add(new PersonAsignmentML(Memory.REG1, new PersonMLExpression(Memory.Stack))); res.add(new StackPopML(Memory.Stack)); res.add( new PersonAsignmentML( Memory.REG1, new AdditionMLExpression( new PersonMLExpression(Memory.REG1), new PersonMLExpression(Memory.Stack)))); return res; } return null; }
public AdditionExpressionEquiv(AdditionExpression additionExpression) { e = ExpressionEquiv.getEquiv(additionExpression.getE1()); e2 = ExpressionEquiv.getEquiv(additionExpression.getE2()); simpE = e.simpleExpression() && e2.simpleExpression(); }