Begin work on tree transformers.

These can probably be made a lot more efficient by e.g. modifying the tree
in place, but I don't feel like this is going to really matter at all in
the long run, and the current implementation is easier to write.
Add tree transformer for removing trace and empty nodes.