private void Destination(Instruction instruction, ParseNode operandNode) { switch (operandNode[0].RuleName) { case "constant": return; case "register": instruction.Destination(Register.Parse(operandNode.Value)); return; case "memoryAddress": instruction.Destination(MemoryAddress.Parse(operandNode["register"].Value)); return; } }
private void Source(Instruction instruction, ParseNode operandNode) { switch (operandNode[0].RuleName) { case "constant": instruction.Source(uint.Parse(operandNode["number"].Value)); return; case "register": instruction.Source(Register.Parse(operandNode.Value)); return; case "memoryAddress": instruction.Source(MemoryAddress.Parse(operandNode["register"].Value)); return; } }