30
CS269: HW/SW Engineering of Embedded Systems, Winter02
Steps to Write a Visitor (3)
– if all nodes need to be visited and the return value of the children will be needed by the parent.
• TM_CHILDREN_FIRST
– visit children, then visit myself. Return value can be stored in the parent node.
• TM_SELF_FIRST
– visit myself, then visit children
– Used if all nodes need to be visited and the return value of the children is not required.