Exemple #1
0
        public OneAddressInstruction(List <Variable> variables, Variable variable)
        {
            InitializeComponent();
            ScopeVariables = variables;
            Variable       = variable;

            SingleInstruction = new SingleInstruction {
                InstructionType = Enums.InstructionType.SingleAddress
            };
        }
Exemple #2
0
        private void SetString(Assignment assignment)
        {
            AssignmentString = assignment.Variable;



            AssignmentString += "=";
            if (assignment.Instruction.InstructionType == Enums.InstructionType.SingleAddress)
            {
                SingleInstruction instruction = (SingleInstruction)assignment.Instruction;
                if (instruction == null)
                {
                    return;
                }
                ParseInstruction(instruction.Instruction);
            }

            else if (Assignment.Instruction.InstructionType == Enums.InstructionType.ThreeAddress)
            {
                ThreeAddressInstruction instruction = (ThreeAddressInstruction)assignment.Instruction;
                if (instruction == null)
                {
                    return;
                }
                ParseInstruction(instruction.LeftInstruction);

                AssignmentString += instruction.Operator;

                ParseInstruction(instruction.RightInstruction);
            }



            AssignmentStringLable.Text  = AssignmentString;
            Assignment.AssignmentString = AssignmentString;
        }
Exemple #3
0
 /// <summary>Creates a interupting "while" loop. It differs from a real while loop as the condition is a process that runs in parallel to the loop body and interrupts the body whenever it terminates</summary>
 /// <param name="condition">Instruction that makes the loop stop when it terminates</param>
 /// <param name="instructions">Instruction to execute in a loop</param>
 public WhileInstruction(SingleInstruction condition, List <Instruction> instructions) : base(instructions)
 {
     this.condition = condition;
 }