def return_action(self, text, loc, ret):
        """Code executed after recognising a return statement"""
        exshared.setpos(loc, text)
        if DEBUG > 0:
            print("RETURN:",ret)
            if DEBUG == 2: self.symtab.display()
            if DEBUG > 2: return
        if not self.symtab.same_types(self.shared.function_index, ret.exp[0]):
            raise SemanticException("Incompatible type in return")
        #set register for function's return value to expression value
        reg = self.codegen.take_function_register()
        self.codegen.move(ret.exp[0], reg)
        #after return statement, register for function's return value is available again
        self.codegen.free_register(reg)
        #jump to function's exit
        self.codegen.unconditional_jump(self.codegen.label(self.shared.function_name+"_exit", True))
Code executed after recognising a return statement