def parser_combinator(top, lookup, combinator, tokens):
    """Parse the given tokens, combining in the given fashion.

    Args:
        top: The top-level parser.  Separates the tokens into
            sections which can be consumed by the parsers in the
            lookup function.
        lookup: For a given section from the top-level parser,
            returns a list of possible parsers.
        combinator: Combines the resultant nodes from parsing
            each section from the top-level parser.
        tokens: The tokens to be parsed.

    Returns:
        The top-level node from the combinator.

    """
    sections = top(tokens)
    parsed_sections = list()
    for i, section in enumerate(sections):
        parsed = None
        for parse in lookup(section, i):
            parsed = parse(section)
            if parsed:
                break
        if not parsed:
            return None
        parsed_sections.append(parsed)
    return combinator(*parsed_sections)