Improved Parser

Made sure that we don't immediatly fail cyclic rules and instead merely
indicate the branch has failed, pulled the history implementation into
its own class, so people can write their own implementations.