Make parsing common between frontend and backend

Close #35