That's just the kind of problem that I wrote my own code generator for. It's a java applet, you can see it on my homepage at http://artsci.wustl.edu/~jplate/pasi.html#applet_section .
To draw your diagram, you just need to do these basic steps:
0. Add "\usepackage{texdraw}" to your preamble...