The current JacMachine VM facilities the ability to handle the VM-related functionalities on loaded jac programs such as listing and updating walkers, nodes etc e.g
import:py from jaclang.runtimelib.machine {JacMachine}
walker test_walker {
can visit_nodes with `root entry {
visit [-->](`?test_node);
}
}
walker child_walker :test_walker: {}
node test_node {
has value:int;
can print_value with test_walker entry {
print("Value:", f'{self.value}');
}
}
with entry {
modules = JacMachine.get().list_modules();
print(modules);
nodes = JacMachine.get().list_nodes('__main__');
print(nodes);
}
A needed extension of the JacMachine is the ability to spawn/instantiate defined archetypes, particularly nodes and walkers for now. This should be easily extensible to edges and jac objects as they are all python classes. A desired interface would look like the following:
import:py from jaclang.runtimelib.machine {JacMachine}
walker test_walker {
can visit_nodes with `root entry {
visit [-->](`?test_node);
}
}
walker child_walker :test_walker: {}
node test_node {
has value:int;
can print_value with test_walker entry {
print("Value:", f'{self.value}');
}
}
with entry {
for value in range(10) {
root ++> test_node(value=value);
}
modules = JacMachine.get().list_modules();
print(modules);
nodes = JacMachine.get().list_nodes('__main__');
print(nodes);
node_obj = JacMachine.get().spawn_node('test_node', {'value': 42});
node_obj.print_value();
walker_obj = JacMachine.get().spawn_walker('child_walker');
root spawn walker_obj;
}
I just updated the interface from create_ to spawn_. Let's save create for undefined archetypes. Spawn will be the interface for already defined archetypes.
The current
JacMachine
VM facilities the ability to handle the VM-related functionalities on loaded jac programs such as listing and updating walkers, nodes etc e.gA needed extension of the
JacMachine
is the ability to spawn/instantiate defined archetypes, particularly nodes and walkers for now. This should be easily extensible to edges and jac objects as they are all python classes. A desired interface would look like the following: