Most of the work is handled by 2to3, but there's a few extra tricks
needed to finish the job, mostly about picking the right bits to be
Unicode and the right bits to be bytes.
Reliable technical documentation for how these instructions are decoded is a
little thin on the ground online, so some of this implementation is still
speculative.
An .outfile directive lets sources suggest default filenames.
Also, .include, .require, .incbin, and .charmapbin are relative
to their _source file_ as opposed the _directory you called Ophis
from_, like it really should have always been.
Full PEP8 compliance. Also, booleans have been inserted where
they make sense (introduced in 2.3!) and I haven't knowingly
added anything that will break 2.3 compatibility.
At this point the code really doesn't look like it was written
ten years ago. Hooray!
This pass actually isn't an optimizer in that it produces larger
binaries when it triggers. However, the larger binaries created
will actually assemble properly.
The ExtendBranches pass detects Relative instructions (that is,
branches) that extend past the signed-8-bit range Relative instructions
permit, and replaces them with a branch-jump combination with identical
semantics.
Since this may be evidence of a program bug, Ophis will warn when
the optimization is triggered.
Due to similarities between this pass and UpdateLabels, both passes
have been refactored in passing.