extract the parser api to a base class