A naïve way of enforcing right-branching guarantee is to do a complete transformation of the subtree on the stack into a right-branching one.
in the worst case the method will reach the bottom of the tree, but often only 3 or 4 nodes need to be transformed to make the tree perfectly the right branching The worst case complexity of repairing the imperfection is O(n) which makes the complexity of the whole parsing algorithm O(n 2 ) for building a single derivation.