stack_cursor is a forward cursor storing its path in a stack
of cursors. Each forward move along a transition pushes a new forward
cursor onto the stack top and an extra method backward allows
to pop. The depth-first traversal cursor dfirst_cursor
relies on the stack_cursor.