Code Monkey home page Code Monkey logo

Comments (5)

MatthieuDartiailh avatar MatthieuDartiailh commented on August 24, 2024

Do you have any ideas on how to do that ?

from enaml.

peterazmanov avatar peterazmanov commented on August 24, 2024

If I remember correctly this part of changes is related to WIP-changes in parser.

I think the easiest way to go is to support enaml-syntax version the same as that of the package. I believe the amount of enaml code out there isn't that big, so if one wants to move to Python 3 it won't be a problem to convert enaml code too.

As of the way to achieve this. parser.py defines the syntax, so we can't implement support of both Python versions in one file. So basically one should take old version and name it for example _parser2.py, name new version _parser3.py and choose which module to import in parser.py based on Python version. Maybe there is more elegant way...

from enaml.

MatthieuDartiailh avatar MatthieuDartiailh commented on August 24, 2024

I will have to look at both versions but one way to make things easier to maintain may be to write the parser as a class (possible in pyparsing). This way we can have a base class handling common patterns and add more cases in a Python2 and Python3 subclasses. I will look into both and see what amount of code is duplicated to see whether or not this is pertinent.

from enaml.

peterazmanov avatar peterazmanov commented on August 24, 2024

Currently there is quite a large amount of common code, but it won't be the case when full Python 3 grammar would be supported. In source of Python there is explicit grammar of the language, and I suspect it was the source for original version of parser.py. You can compare grammars of different Python versions to estimate the amount of common grammar rules, which as I understand you consider putting in base class.

from enaml.

MatthieuDartiailh avatar MatthieuDartiailh commented on August 24, 2024

Thanks for the pointer. I will give it a look.

from enaml.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.