reimplemented _prefix_to_tree for efficiency

New method processes the prefix in a manner similar to machine code, with the input register represented through the call stack. This implementation no longer requires a node in the parse tree to be read twice.