refactor Parser

-refactor Parser
-add a proper test case skeleton for Parser