Open dours opened 2 years ago
Yes, I have an implementation for Python 3.10 in ANTLR4. I'll share in a few days.
uploaded: https://github.com/RobEin/ANTLR4-Python-grammar-by-PEG
I'm not uploading it to the ANTLR4 repository yet because it has yet to be tested. I have passed all the old tests, but I don't have many files about the latest features yet.
@RobEin Thank you very much! I'll try to use it soon.
I still have to work on it. The parser is extremely slow but looks like it works. The grammar was tested with the latest Python standard library. I found a mistake.
I have also uploaded another version (3.8.12) which can also handle the named expressions. It's fast enough, but it's still being tested. I hope it helps.
The above grammars generate Java code is that true? Do you know of what that generates Python code? Actually, I tried to generate python code with these. I got a serialization error
A Python 3.11.4 parser for ANTLR4 is ready. It looks like it's working fine, although it's still very slow. If you are interested, please test it. https://github.com/RobEin/ANTLR4-Python-grammar-by-PEG
An assignment expression (sometimes also called a “named expression” or “walrus”) assigns an expression to an identifier, while also returning the value of the expression.
One common use case is when handling matched regular expressions:
Or, when processing a file stream in chunks:
From https://docs.python.org/3/reference/expressions.html#assignment-expressions