Beispiel #1
0
        /// <summary>
        /// Generates code for a while command node
        /// </summary>
        /// <param name="whileCommand">The node to generate code for</param>
        private void GenerateCodeForWhileCommand(WhileCommandNode whileCommand)
        {
            Debugger.Write("Generating code for While Command");
            Address jumpAddress = code.NextAddress;

            code.AddInstruction(OpCode.JUMP, Register.CB, 0, 0);
            Address loopAddress = code.NextAddress;

            GenerateCodeFor(whileCommand.Command);
            code.PatchInstructionToJumpHere(jumpAddress);
            GenerateCodeFor(whileCommand.Expression);
            code.AddInstruction(OpCode.JUMPIF, Register.CB, TrueValue, loopAddress);
            return;
        }
Beispiel #2
0
 /// <summary>
 /// Carries out identification on a while command node
 /// </summary>
 /// <param name="whileCommand">The node to perform identification on</param>
 private void PerformIdentificationOnWhileCommand(WhileCommandNode whileCommand)
 {
     PerformIdentification(whileCommand.Expression);
     PerformIdentification(whileCommand.Command);
 }