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

Deep precedence #6

Open
elegios opened this issue Nov 13, 2019 · 0 comments
Open

Deep precedence #6

elegios opened this issue Nov 13, 2019 · 0 comments
Labels
bug Something isn't working research This issue has a strong connection to the underlying research, as opposed to 'mere' engineering

Comments

@elegios
Copy link
Collaborator

elegios commented Nov 13, 2019

The current approach to precedence lacks an important guarantee: if all operators have defined relative precedence and compatible associativity, then no expression using those operators should have ambiguous grouping. This can for example be seen in the following example:

type Exp
grouping "(" Exp ")"

syncon top: Top = e:Exp

syncon unit: Exp = "unit"
infix in: Exp = "in"
prefix pre: Exp = "pre"

precedence {
  in;
  pre;
}

The expression unit in pre unit in unit produces the following error:

Ambiguity error with 2 alternatives.

  ( unit in pre unit ) in unit
  unit in pre ( unit in unit )

 deep.test#1:1:
   1: unit in pre unit in unit

Most likely the former alternative is undesired. The issue is that the precedence error requires looking more than one level down the tree (since pre is an indirect child of the right in).

@elegios elegios added bug Something isn't working research This issue has a strong connection to the underlying research, as opposed to 'mere' engineering labels Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working research This issue has a strong connection to the underlying research, as opposed to 'mere' engineering
Projects
None yet
Development

No branches or pull requests

1 participant