def get_grammar_arrows(p, start):
    """Get the links between grammar nodes.

    Yield pairs (2-tuples).  Each tuple ``(head, tail)`` means that tail is in
    the right side of some production ``head ::= ... tail ...``.

    """
    rules = list(p.rules[start])
    seen = set()
    while rules:
        head, prod = rules.pop(0)
        seen.add(head)
        new = set()
        for which in prod:
            if which not in new and which not in seen:
                new.add(which)
                yield head, which
                rules.extend(p.rules.get(which, []))
