Skip to content

--new-parser fails #1132

Closed
Closed
@certik

Description

@certik

Here is an example where --new-parser fails:

def main():
    a: list[i32]
    a = list()

main()

in the PR #1098. It fails with:

$ lpython a.py --new-parser --show-asr --indent
Traceback (most recent call last):
  File "/Users/ondrej/repos/lpython/src/bin/../runtime/lpython_parser.py", line 2, in <module>
    import python_ast
  File "/Users/ondrej/repos/lpython/src/runtime/python_ast.py", line 2317
    def visit_Module(self, x: Module):
                            ^
SyntaxError: invalid syntax
The command 'python /Users/ondrej/repos/lpython/src/bin/../runtime/lpython_parser.py /Users/ondrej/repos/lpython/src/bin/../runtime/lpython_builtin.py /Users/ondrej/repos/lpython/src/bin/../runtime/lpython_builtin.py89FF131' failed.
semantic error: The file '/Users/ondrej/repos/lpython/src/bin/../runtime/lpython_builtin.py' failed to parse
 --> a.py:3:9
  |
3 |     a = list()
  |         ^^^^^^ 


Note: if any of the above error or warning messages are not clear or are lacking
context please report it to us (we consider that a bug that needs to be fixed).

It is trying to compile the builtin module using the old parser, but it should not.

Once we switch to the new parser, then this should go away.

Metadata

Metadata

Labels

ParserIssues or improvements related to parsercould closeIssues/PRs which can be closed.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions