refactored parser to change AST to ML-like one.