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

Syntax definition symbol :label ("Reference") not supported #1541

Closed
tvdstorm opened this issue Nov 29, 2021 · 3 comments
Closed

Syntax definition symbol :label ("Reference") not supported #1541

tvdstorm opened this issue Nov 29, 2021 · 3 comments

Comments

@tvdstorm
Copy link
Member

The syntax definition symbol :label (to refer to a production in syntax rule) is not supported.
Example:

syntax Expr 
  = \bool: Bool | var: Id | bracket "(" Expr ")"
  | not: "!" Expr
  > left and: Expr "&&" Expr
  > left or: Expr "||" Expr; 

Now I should be able to modularly insert new productions into the priority hierarchy. Like so:

syntax Expr
  = :not
  > non-assoc ( lt: Expr "\<" Expr | leq: Expr "\<=" Expr
    | geq: Expr "\>=" Expr | gt: Expr "\>" Expr
    | eq: Expr "==" Expr | neq: Expr "!=" Expr )
  > :and ;

But neither the parser generator (parse errors when parsing expressions), or the type reflector seem to support it (the reference symbols are still in the reified type).

@jurgenvinju
Copy link
Member

It's strange, the feature is implemented here:

So this is not a feature request, but rather a bug issue report.

@jurgenvinju
Copy link
Member

The reified type is supposed to still have the references in them, but the parser generator should resolve them during priority resolution, and then the right priorities are implemented without introducing a duplicate rule in the original grammar.

@jurgenvinju
Copy link
Member

TODO: need to find where this feature is tested.

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

No branches or pull requests

2 participants