Paulper stack reduction

Rewrites the parser stack reduction logic, rebased.

Review by @densh or @retronym