move non-ast code to parser package