__init__.py 1.2 KB

1234567891011121314151617181920212223242526272829
  1. """Here we have "scanners" for the different Python versions.
  2. "scanner" is a compiler-centric term, but it is really a bit different from
  3. a traditional compiler scanner/lexer.
  4. Here we start out with text disasembly and change that to be more
  5. ameanable to parsing in which we look only at the opcode name, and not
  6. and instruction's operand.
  7. In some cases this is done by changing the opcode name. For example
  8. "LOAD_CONST" it customized based on the type of its operand into
  9. "LOAD_ASSERT", "LOAD_CODE", "LOAD_STR".
  10. instructions that take a variable number of arguments will have the argument count
  11. suffixed to the opcode name. "CALL", "MAKE_FUNCTION", "BUILD_TUPLE", "BUILD_LIST",
  12. work this way for example
  13. We also add pseudo instructions like "COME_FROM" which have an operand
  14. Instead of full grammars, we have full grammars for certain Python versions
  15. and the others indicate differences between a neighboring version.
  16. For example Python 2.6, 2.7, 3.2, and 3.7 are largely "base" versions
  17. which work off of scanner2.py, scanner3.py, and scanner37base.py.
  18. Some examples:
  19. Python 3.3 diffs off of 3.2; 3.1 and 3.0 diff off of 3.2; Python 1.0..Python 2.5 diff off of
  20. Python 2.6 and Python 3.8 diff off of 3.7
  21. """