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

Implicit multiplication involving a suffix operator #719

Closed
christianp opened this issue Jul 28, 2020 · 2 comments
Closed

Implicit multiplication involving a suffix operator #719

christianp opened this issue Jul 28, 2020 · 2 comments
Labels

Comments

@christianp
Copy link
Member

I keep writing $n`? $v, which currently gives a "missing operator" error. I should write $n`? * $v.

The expression n!x also has this problem.

So, the parser should insert an implicit multiplication symbol following a suffix operator.

@christianp
Copy link
Member Author

There is an ambiguity, because ! can be a prefix or postfix operator, so a!b could be either (a!)*b or a*(!b).

christianp added a commit that referenced this issue Aug 8, 2022
@christianp
Copy link
Member Author

I've decided to go with preferring the postfix version.

The equivalent problem with prefix operators still exists, but I had a look at how they're produced, and I think there are lots more potential ambiguities if I dig any deeper. At the moment, a prefix op token can only be produced following punctuation or a non-postfix op. Adding in implicit multiplication would lead to loads of ambiguities. For example, does a-b represent (a)-(b), or a * (-b)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant