public static int RunProgram(IReadOnlyDictionary <int, Op> ops, string programText) { var regs = new int[4]; foreach (var instr in Instr.Parse(programText)) { ops[instr.Id].Exec(instr, regs); } return(regs[0]); }