.. _dereference_run:

		Converts the commands to opcodes and inserts the (relative or static) references.

def dereference_run(self, arg_r):
		"""
		.. _dereference_run:

		Converts the commands to opcodes and inserts the (relative or static) references.
		
		"""
		wc = 0
		der_run = []
		for line in arg_r:
			args = []
			for argument in line[3]:
				logging.debug("dereference run: handling argument " + str(argument))
				if(isinstance(argument, int)):
					logging.debug("Argument interpreted as integer")
					args.append(argument)
					continue
				if((not argument in self.refs) and 
						(not argument in self.static_refs)):
					raise ArgumentError("[line {}]: Argument '{}' is neither an int nor a reference.".format(line[0], argument))
				if(argument in self.static_refs):
					logging.debug("Argument interpreted as static reference")
					args.append(self.static_refs[argument][0])
					continue
				my_word = wc
				ref_word = self.refs[argument][0]
				args.append(ref_word - my_word)
				logging.debug("Argument interpreted as reference")
			data = []
			if(line[1] == "command"):
				data = [line[2].opcode()]
			data.extend(args)
			wc += len(data)
			der_run.append((line[0], line[1], data))
		return der_run