Tue Aug 17 09:46:52 CEST 2010
Explicit recursion and post-ops.
To write a tree descent algorithm which performs an operation _after_
recursion in the tree, the recursion stack needs two types of
"continuations". One for the child traversal, and one for the
This is exactly the same problem as the representation of
continuations in a language interpreter. The solution is to build a
stack which has elements that are unions instead of structs, and write
a dispatcher (pattern matcher) for the different component types.