Paulper stack reduction

Rewrites the parser stack reduction logic, rebased.