Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with translator #251

Open
nikololiahim opened this issue May 22, 2022 · 1 comment
Open

Issues with translator #251

nikololiahim opened this issue May 22, 2022 · 1 comment
Assignees

Comments

@nikololiahim
Copy link
Member

Description

Good afternoon! Recently we have tried to integrate py2eo into polystat-cli. The integration process went smoothly. We ran the translator for simple test files . For example, classes.py

class Base:
    def f(self, v):
        self.g(v)
    def g(self, v):
        v += 1
        print(v)

class Derived(Base):
    def g(self, v):
        self.f(v)

if __name__ == "__main__":
    print(Derived().g(12))

is translated into classes.eo as follows:

+package org.eolang
+junit
memory > xBase
memory > xDerived
memory > xprint
memory > x__name__
[] > classes.py
  [args...] > unsupported
  [args...] > xunsupported
  memory > bogusForceDataize
  memory > xbogusForceDataize
  memory > xhack
  seq > @
    xhack.write
      []
        memory > xg
        memory > xf
        seq > @
          seq
            (((unsupported)).apply)
              seq
                xf.write
                  [xself xv]
                    seq > @
                      bogusForceDataize.write ((((xself).xg)).apply ((xv)))
                xg.write
                  [xself xv]
                    seq > @
            (((unsupported)).apply ((xBase)))
              xg.write
                [xself xv]
                  seq > @
                    bogusForceDataize.write ((((xself).xf)).apply ((xv)))
            ((x__name__).eq "__main__").if
              bogusForceDataize.write (((xprint)).apply (((((((xDerived)).apply).xg)).apply (12))))

Issues

  1. There is little correspondence between EO output and Python code. It is not clear, where classes and methods are. It also seems like there are some features of Python that are not suported.
  2. Judging by test.py and test_imports.py, imports are not supported by the translator yet. Without imports it would be very unlikely to get many results by analyzing the real world projects.
@dours
Copy link
Collaborator

dours commented May 22, 2022

@nikololiahim Good night! There are many questions in one issue here. I will try to make the Base/Derived example fully supported first. If you don't mind.

@dours dours self-assigned this May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants