public string parse_c_instruction(string instruction) { string c_instruction_bin; string dest = "000"; string comp = "00000000"; string jump = "000"; Symbol Match; int index; index = instruction.IndexOf('='); if (index > 0) { jump = "000"; dest = instruction.Substring(0, index); Match = DestTable.FirstOrDefault(i => i.Name == dest); if (Match != null) { dest = Match.Value; } comp = instruction.Substring(index + 1, instruction.Length - index - 1); Match = CompTable.FirstOrDefault(i => i.Name == comp); if (Match != null) { comp = Match.Value; } } index = instruction.IndexOf(';'); if (index > 0) { dest = "000"; comp = instruction.Substring(0, index); Match = CompTable.FirstOrDefault(i => i.Name == comp); if (Match != null) { comp = Match.Value; } jump = instruction.Substring(index + 1, instruction.Length - index - 1); Match = JumpTable.FirstOrDefault(i => i.Name == jump); if (Match != null) { jump = Match.Value; } } c_instruction_bin = "11" + comp + dest + jump; return(c_instruction_bin); }