Demo entry 6737307

code

   

Submitted by anonymous on Apr 30, 2018 at 11:10
Language: Python 3. Code size: 515 Bytes.

def checkAndFind(taci, operation=None):
	opcode = taci.getAttribute("opcode")
	inst = {}

	for child in taci.childNodes:
		operand = {"kind":"variable", "type":"string", "data":child.childNodes[0].data}

		if child.hasAttribute("kind"):
			operand["kind"] = child.getAttribute("kind")
			if child.getAttribute("kind") == "literal":
				operand["type"] = "int"

		if child.hasAttribute("type"):
			operand["type"] = child.getAttribute("type")

		inst[child.nodeName] = operand
	
	return inst, opcode

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).