public override List <InstructionModel> GetInstructions(CompilationModel model) { var instructions = new List <InstructionModel>(); instructions.AddRange(LeftExpression.GetInstructions(model)); instructions.AddRange(RightExpression.GetInstructions(model)); instructions.Add(new InstructionModel(Instructions.MulIntInstruction)); return(instructions); }
public override List <InstructionModel> GetInstructions(CompilationModel model) { var instructions = new List <InstructionModel>(); instructions.AddRange(LeftExpression.GetInstructions(model)); instructions.AddRange(RightExpression.GetInstructions(model)); instructions.Add(new InstructionModel(Instructions.AddIntInstruction)); instructions.Latest().Comment = model.GetComment(this); return(instructions); }
public override List <InstructionModel> GetInstructions(CompilationModel model) { var instructions = new List <InstructionModel>(); instructions.AddRange(LeftExpression.GetInstructions(model)); instructions.AddRange(RightExpression.GetInstructions(model)); instructions.Add(new InstructionModel(Instructions.IfIntLtInstruction, "3")); instructions.Add(new InstructionModel(Instructions.PushIntInstruction, "1")); instructions.Add(new InstructionModel(Instructions.JumpInstruction, "2")); instructions.Add(new InstructionModel(Instructions.PushIntInstruction, "0")); instructions[instructions.Count - 3].Comment = model.GetComment(this); return(instructions); }