A Framework for Generating Distributed-Memory Parallel Programs for Block Recursive Algorithms