[Libre-soc-bugs] [Bug 1094] insndb instruction database visitor-walker is needed
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Thu Jun 8 11:51:13 BST 2023
https://bugs.libre-soc.org/show_bug.cgi?id=1094
--- Comment #62 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
https://github.com/python/cpython/blob/2.7/Lib/ast.py#L203
ah - i know how to make this do breadth-first(?) order:
def walk(node):
from collections import deque
todo = deque([node])
todonext = deque()
while todo:
node = todo.popleft()
todonext.extend(iter_child_nodes(node))
yield node
if not todo:
todo = todonext
todonext = deque()
and that should do breadth-first node-walking. i am not entirely sure
how to do depth-first.. is it that you just move the "yield node" up?
i leave it with you to work out?
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list