finished implementation of parser