Implements generic parser.