remove unused definitions, move toplevel parser def. to parser module