midway step of parser for matching words