Introduce a Context module

By having a separate context module inside the parser, we make it easier to explain what happens on contexts
without having to have these functions all over the place. The splitting also suggests some further cleanup in
the code base, where we don't want stuff to linger anymore.