private void PerformIdentificationOnForCommand(ForCommandNode forCommand) { PerformIdentification(forCommand.Identifier); PerformIdentification(forCommand.Expression); PerformIdentification(forCommand.ExpressionTo); PerformIdentification(forCommand.Command); }
/// <summary> /// /// </summary> /// <param name="forCommand"></param> private void PerformIdentificationOnForCommand(ForCommandNode forCommand) { SymbolTable.OpenScope(); PerformIdentification(forCommand.Assign); PerformIdentification(forCommand.Expression); PerformIdentification(forCommand.Command); SymbolTable.CloseScope(); }
private void GenerateCodeForForCommand(ForCommandNode forCommand) { Debugger.Write("Generating code for forCommand"); GenerateCodeFor(forCommand.Expression); Address ifJumpAddress = code.NextAddress; code.AddInstruction(OpCode.JUMPIF, Register.CB, FalseValue, 0); Address thenJumpAddress = code.NextAddress; code.AddInstruction(OpCode.JUMP, Register.CB, 0, 0); code.PatchInstructionToJumpHere(ifJumpAddress); code.PatchInstructionToJumpHere(thenJumpAddress); }
private void GenerateCodeForForCommand(ForCommandNode forCommand) { Debugger.Write("Generating code for the ForCommandNode"); scopes.AddScope(); GenerateCodeFor(forCommand.Assign); Address forJumpAddress = code.NextAddress; GenerateCodeFor(forCommand.Expression); Address commandJumpAddress = code.NextAddress; code.AddInstruction(OpCode.JUMPIF, Register.CB, FalseValue, 0); GenerateCodeFor(forCommand.Command); code.AddInstruction(OpCode.JUMP, Register.CB, 0, forJumpAddress); code.PatchInstructionToJumpHere(commandJumpAddress); code.AddInstruction(OpCode.POP, 0, 0, scopes.GetLocalScopeSize()); scopes.RemoveScope(); }
private void GenerateCodeForForCommand(ForCommandNode forCommand) { scopes.AddScope(); Debugger.WriteDebuggingInfo("Generating code for For command"); GenerateCodeFor(forCommand.Expression); Address forJumpAddress = code.NextAddress; code.AddInstruction(OpCode.JUMPIF, Register.CB, FalseValue, 0); code.PatchInstructionToJumpHere(forJumpAddress); GenerateCodeFor(forCommand.Identifier); Address idJumpAddress = code.NextAddress; code.PatchInstructionToJumpHere(idJumpAddress); // code.AddInstruction(OpCode.JUMPIF, Register.CB, FalseValue, 0); GenerateCodeFor(forCommand.ToExpression); Address toJumpAddress = code.NextAddress; code.PatchInstructionToJumpHere(toJumpAddress); // code.AddInstruction(OpCode.JUMPIF, Register.CB, FalseValue, 0); GenerateCodeFor(forCommand.BecomesExpression); Address becomesJumpAddress = code.NextAddress; code.PatchInstructionToJumpHere(becomesJumpAddress); }