-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f01758
commit d7b286e
Showing
3 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
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(1, 4) { | ||
root ++> test_node(value=value); | ||
} | ||
node_obj = JacMachine.get().spawn_node('test_node', {'value': 0}); | ||
walker_obj = JacMachine.get().spawn_walker('child_walker'); | ||
root spawn walker_obj; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters