completed parser for examples 1 and 2