public ProgramState Copy() { var copy = new ProgramState { IP = IP, Key = Key, Stack = Stack.Copy(), Registers = Registers.Copy(), IgnoreExitKey = IgnoreExitKey }; foreach (var value in EHStack.Reverse()) { copy.EHStack.Push(value); } return(copy); }