def arithmetic(self, operation, operand1, operand2, operand3 = None):
if isinstance(operand1, int):<EOL><INDENT>output_type = self.symtab.get_type(operand1)<EOL>self.free_if_register(operand1)<EOL><DEDENT>else:<EOL><INDENT>output_type = None<EOL><DEDENT>if isinstance(operand2, int):<EOL><INDENT>output_type = self.symtab.get_type(operand2) if output_type == None else output_type<EOL>self.free_if_register(operand2)<EOL><DEDENT>else:<EOL><INDENT>output_type = SharedData.TYPES.NO_TYPE if output_type == None else output_type<EOL><DEDENT>output = self.take_register(output_type) if operand3 == None else operand3<EOL>mnemonic = self.arithmetic_mnemonic(operation, output_type)<EOL>self.newline_text("<STR_LIT>".format(mnemonic, self.symbol(operand1), self.symbol(operand2), self.symbol(output)), True)<EOL>return output<EOL>
Generates an arithmetic instruction
           operation - one of supporetd operations
           operandX - index in symbol table or text representation of operand
           First two operands are input, third one is output