parse: Refactor grammar, make it more consistent and fix conflicts