Detect and report dependency cycles
Add option to write script to file
Add regression test

We compare the generated code and graphs with a reference version.
This can catch problems in the dot graph generation and things
not handled by the test cases.
Handle gathering of /sgsh data in the scatter block

Also refactor scatter argument parsing into a separate
subroutine.