Make compiler fully compatible with py3 while retaining py2 support #34
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Compiler/ directory was only compatible with Python2. This is a big issue since py2 support officially ended on January 1, 2020. In the interest of causing the least amount of friction, I retained py2 support in this diff, but my primary goal was to get the compiler to run in py3.
Here's the process I went through to add py3 support:
long
type hack, unicode/bytes, remove relative imports)I may have missed some minor differences with int vs long still, so I'll audit my own changes again.
For testing, I simply ran
python2 compile.py Programs/test_all/
andpython3 compile.py Programs/test_all/
. I'm not sure if there's a more rigorous way to test, but these both work with my changes.Very open to any feedback you may have. I realize these changes may not be the prettiest, but my goal was functionality while touching as few lines of code as possible instead of making it look good.