private static void ExecuteInstructionFromFile(string filename) { var parser = new InstructionInterpreter(filename); var controller = new HardwareInstructionController(); HardwareInstruction instruction; while ((instruction = parser.GetNextInstruction()) != null) { Console.WriteLine("\n[{0}{1}]", instruction.Operator, instruction.HasOperand ? " " + instruction.Operand : string.Empty); if (instruction.Operator == HardwareOperator.NoOp || instruction.Operator == HardwareOperator.Exit) { break; } else { controller.ExecuteInstruction(instruction); } } }