def useall(self, module_name): try: m = self.sistem.modüller[module_name] except: m = api.loadmodule(module_name) self.sistem.modüller[module_name] = m self.current_scope.update(m)
def use(module_name): try: m = modules[module_name] except: m = loadmodule(module_name) modules[module_name] = m current_scope[module_name] = m
def useall(module_name): try: m = modules[module_name] except: m = loadmodule(module_name) modules[module_name] = m current_scope.update(m)
def __init__(self, builtins: dict[str, object] = None): #initialize interpreter self.stack = [] self.points = [0] self.scopes = [] self.current_scope = None if builtins == None: self.builtins = defaultbuiltins.copy() #setup sys library lib_path = "lib" # daha sonra kütüphane yap sys_lib = "sistem" self.sistem = api.loadmodule(sys_lib, (lib_path, ), self) self.sistem.modüller[sys_lib] = self.sistem self.sistem.dizinler.append(lib_path) #debug debug = 1 if debug: debug_scopes = lambda: print(self.scopes) debug_stack = lambda: print(self.stack) debug_module = lambda: print(self.sistem.modüller) debug_points = lambda: print(self.points) self.builtins["scopes"] = debug_scopes self.builtins["stack"] = debug_stack self.builtins["modules"] = debug_module self.builtins["points"] = debug_points