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

Parse ellipsis (...) in the old parser #503

Merged
merged 3 commits into from
May 18, 2022
Merged

Conversation

certik
Copy link
Contributor

@certik certik commented May 17, 2022

No description provided.

@certik
Copy link
Contributor Author

certik commented May 17, 2022

@Thirumalai-Shaktivel if you wouldn't mind adding tests for .. and None, then we can merge this.

@@ -83,6 +83,8 @@ module LPython
| ConstantBool(bool value, string? kind)
| ConstantFloat(float value, string? kind)
| ConstantComplex(float re, float im, string? kind)
| ConstantEllipsis(string? kind)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are we going to support this in the ASR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ... is similar to pass, so that's just an empty subroutine, so you leave the body argument empty in ASR.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I've noticed is that people use Ellipsis to indicate something they want to fill in later (like a todo empty block) and pass stmt to mean a block is intended to have no code.

... is used in NumPy code, too, as a placeholder in slice notation.
See more uses here: https://python.land/python-ellipsis

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has different uses. For the "empty block" use, we can just represent that with an empty block in ASR.

@Thirumalai-Shaktivel Thirumalai-Shaktivel added the Parser Issues or improvements related to parser label May 18, 2022
@certik certik merged commit 7fe6666 into lcompilers:main May 18, 2022
@certik certik deleted the ellipsis branch May 18, 2022 20:27
@certik
Copy link
Contributor Author

certik commented May 18, 2022

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Parser Issues or improvements related to parser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants