reorganise codes in Parser

-reorganise codes in Parser to follow abstraction levels and increase
readability as the codes go deeper into the abstraction levels from top
to bottom