Refactor parser base classes