parser: split into header and cpp file