RustPython / RustPython

A Python Interpreter written in Rust
https://rustpython.github.io
MIT License
19.22k stars 1.24k forks source link

SyntaxError: match expression is not implemented yet at line 1 column 1 #4770

Open anki-code opened 1 year ago

anki-code commented 1 year ago

Hello! Thank you for this incredible initiative!

I'm trying to run awesome python-powered xonsh shell using RustPython. I removed all import ctype because it is not implemented yet (#1217). But after this I'm facing with this error:

   ...
  File "/Users/usr/.local/lib/rustpython3.11/site-packages/xonsh/execer.py", line 9, in <module>
    from xonsh.parser import Parser
SyntaxError: match expression is not implemented yet at line 1 column 1
"""Implements the xonsh parser."""
^

What is "match expression" in this case? Any plans to implement this? Many thanks!

fanninpm commented 1 year ago

This most likely refers to the syntax introduced in PEP 634.

(Maintainers, correct me if I'm wrong on this.) I think RustPython's parser can parse match statements (likely thanks to the work of Ruff contributors), but RustPython's VM doesn't know what to do with them. RustPython doesn't know how to transform that into bytecode.

Is this something you're interested in working on?

anki-code commented 1 year ago

Because I'm not Rust developer I tend to change xonsh code first if you advice how to have workaround. Or I'll wait for support this.

DimitrisJim commented 1 year ago

What @fanninpm said. match is currently supported until the AST step of the pipeline. The generation into bytecode and then the evaluation of said bytecode is to be added.