Convert the core parser to be synchronous but incremental

Here's my try at this.