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

py2many.exceptions.AstUnrecognisedBinOp translating python script #552

Closed
JalonSolov opened this issue Aug 7, 2023 · 5 comments
Closed

Comments

@JalonSolov
Copy link

JalonSolov commented Aug 7, 2023

  1. Clone https://github.com/elliotchance/vsql
  2. cd vsql
[jalon@7950x vsql]$ ../py2many/py2many.py --v=1 generate-grammar.py
Writing to: .
generate-grammar.py ... generate-grammar.v
generate-grammar.py:136:14: py2many.exceptions.AstUnrecognisedBinOp: str <class 'ast.Mult'> int
Error: ['v', 'fmt', '-w', 'generate-grammar.v'] (code: 1):
b'generate-grammar.v:1:1: error: `FAILED` evaluated but not used\n    1 | FAILED\n      | ~~~~~~\n\nInternal vfmt error while formatting file: generate-grammar.v.\nEncountered a total of: 1 errors.\n'b''
[jalon@7950x vsql]$ ls
bench.vsql  cmd         docs      generate-grammar.py  grammar.bnf  Makefile   readthedocs.yaml  test_concurrent_writes.vsql  v.mod
bin         Dockerfile  examples  generate-grammar.v   LICENSE      README.md  scripts           tests                        vsql
[jalon@7950x vsql]$ cat generate-grammar.v
FAILED[jalon@7950x vsql]$
@JalonSolov JalonSolov changed the title py2many.exceptions.AstUnrecognisedBinOp translating python -> v py2many.exceptions.AstUnrecognisedBinOp translating python script Aug 7, 2023
@JalonSolov
Copy link
Author

Only tried with v originally, then decided to try translating to other langs... same error. So it's not the output type that matters, only the contents of the python script being translated.

div72 added a commit to div72/py2many that referenced this issue Aug 7, 2023
@div72
Copy link
Contributor

div72 commented Aug 7, 2023

@JalonSolov Only the Dart backend seems to support string multiplication from what I can see from tests/test_unsupported.py:204. I've created a PR to add support for the V backend but that file needs some work before it could be transpiled. (file needs some type annotations, object subclass is redundant now, backends will still stumble on something like lambdas)

@JalonSolov
Copy link
Author

V should be fairly easy to support for that - turn it into a .repeat() call.

I tried with Go and Nim and got the same error, but it appeared to work with Rust. At least it generated a file with no error messages.

@div72
Copy link
Contributor

div72 commented Aug 7, 2023

V should be fairly easy to support for that - turn it into a .repeat() call.

See #553.

I tried with Go and Nim and got the same error, but it appeared to work with Rust. At least it generated a file with no error messages.

I'm surprised, does the generated file actually work?

@JalonSolov
Copy link
Author

I don't do Rust, so I have no idea. :-)

@jayvdb jayvdb closed this as completed in dcd0895 Dec 31, 2023
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