2

Is there a parser that:

  • is able to parse Python2.6+ code, and
  • can be run in Python2.5 (python-only, no C extensions allowed)?

NOTE: This is somewhat related to my previous quostion about class decorators.

1 Answer 1

2

Yes, lib2to3 can, all you need to do is to provide it with the right Grammar file (get the source code for the Python you want and copy Grammar/Grammar).

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the tip. I've created some simple fixers that convert Python 2.7 code to Python 2.5 using lib2to3 from the 2.7 stdlib, and an import hook that does the conversion on-the-fly: github.com/aatiis/seven

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.