Continuing what was started in T386452 this task aims to …
- Get rid of as much unnecessary and duplicate code as possible, in both parsers.
- Bring the two parser implementations closer together so reappearing concepts can be recognized easier by someone looking at the code.
- Make the two actually share code. A notable example is what's currently called the "Validator" in the legacy parser.