Added functionality to 'compile' the tree into a sequence of operations.