Switch to insertion-ordered sets and maps in the IR

Fixes #85.

The side effect is also a predictible IR and bytecode generation across
compilations, which is useful for, say, diagnosis.
Merge pull request #86 from jponge/wip/fix-85

Switch to insertion-ordered sets and maps in the IR