Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
devops committed Dec 11, 2024
2 parents c8d0bee + c4d9777 commit 7b6f510
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions pyk/src/pyk/kast/inner.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,20 +877,18 @@ def _var_occurence(_term: KInner) -> None:
return _var_occurrences


# TODO replace by method that does not reconstruct the AST
def collect(callback: Callable[[KInner], None], kinner: KInner) -> None:
"""Collect information about a given term traversing it bottom-up using a function with side effects.
"""Collect information about a given term traversing it top-down using a function with side effects.
Args:
callback: Function with the side effect of collecting desired information at each AST node.
kinner: The term to traverse.
"""

def f(kinner: KInner) -> KInner:
callback(kinner)
return kinner

bottom_up(f, kinner)
subterms = [kinner]
while subterms:
term = subterms.pop()
subterms.extend(reversed(term.terms))
callback(term)


def build_assoc(unit: KInner, label: str | KLabel, terms: Iterable[KInner]) -> KInner:
Expand Down

0 comments on commit 7b6f510

Please sign in to comment.