def run(self, vm: VM): key = pop_value(vm) dict = pop(vm) if key in dict.value: push(vm, dict.value[key][1]) else: push(vm, NullNode(None))
def run(self, vm: VM): quote_false = pop(vm) quote_true = pop(vm) is_true = pop_value(vm) if is_true: vm.run_ast(quote_true.ast) else: vm.run_ast(quote_false.ast)
def run(self, vm: VM): key = pop_value(vm) dict = pop(vm) value = NullNode(None) if key in dict.value: value = dict.value.pop(key)[1] push(vm, dict) push(vm, value)
def run(self, vm: VM): parameters = [] python_function = pop(vm) count_of_parameters = pop_value(vm) for _ in range(0,count_of_parameters): parameters.append(vm.stack.pop().value) parameters = parameters[::-1] result = python_function(*parameters) vm.stack.append(create_node(result))
def run(self, vm: VM): quote = pop(vm) sequence = pop(vm) filtered = ArrayNode() for entry in sequence: run_node(vm, entry) vm.run_ast(quote.ast) result = pop_value(vm) if result: filtered.append(entry) push(vm, filtered)
def run(self, vm: VM): value = pop_value(vm) push(vm, BooleanNode(not value, None))
def run(self, vm: VM): python_code = pop_value(vm) result = create_node(eval(python_code)) push(vm, result)
def run(self, vm: VM): module_name = pop_value(vm) result = import_module(module_name) push(vm, result)
def run(self, vm: VM): key = pop_value(vm) python_module = pop(vm) result = getattr(python_module, key) push(vm, result)
def run(self, vm: VM): value1 = pop_value(vm) value2 = pop_value(vm) value = create_node(value2 / value1) push(vm, value)
def run(self, vm: VM): value = create_node(pop_value(vm) * pop_value(vm)) push(vm, value)
def run(self, vm: VM): quote = pop(vm) is_true = pop_value(vm) if is_true: vm.run_ast(quote.ast)
def run(self, vm: VM): quote = pop(vm) count = pop_value(vm) for _ in range(0, count): vm.run_ast(quote.ast)
def run(self, vm: VM): key = pop_value(vm) dict = pop(vm) push(vm, BooleanNode(key in dict.value, None))
def run(self, vm: VM): push(vm, StringNode(str(pop_value(vm)), None))