moved the rest of the parser code to parser.{h,cpp}, respectively