expression: add utility function to ensure unnamed refs

And use it in rules/algebra. Also add some comments.
cfg: add comment
rules: more helper use
cfg: comment apply_chaining
Merge pull request #317 from uwescience/cfg-speedup

Speedup parser/optimizer handling of very long programs
Merge branch 'master' into decompose-distinct