-
Notifications
You must be signed in to change notification settings - Fork 77
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
Ambiguity issues with 0.11.2 version of the vscode extension #2000
Comments
Some analysis:
For possible workarounds I would suggest extending the Expression module with the Layout module. That way the same layout is applied twice and the source of ambiguity would disappear. That's an educated guess. Please confirm? |
This helped a lot. I was also able to apply this understanding to other parts of my code and it fixed the ambiguity issues I was having. Thank you |
I've reduced the provided example even further. Some more analysis: module A
syntax Expr
= \one: "1"
| left add: Expr lhs "+" Expr rhs
; module B
extend A;
layout Layout = [\ ]*; Note that module
|
I could imagine that priorities between nonterminals could have an additional interplay here: module A
syntax Expr
= \one: "1"
| left mult: Expr lhs "*" Expr rhs
> left add: Expr lhs "+" Expr rhs
; module B
extend A;
layout Layout = [\ ]*; This yields
|
That's a great reduction to the essence @rodinaarssen Conclusion: the interplay between
All of the above suggestions break existing grammars. |
If we remove default layout from the game the parser generator could warn about missing layout definitions where the grammar is used for parsing and concrete syntax. |
Personally i like the default layout because it helps people get started and make results before having crossed all their t's and dotted their i's. Like So: I think it makes sense to not add default layout to rules yet if they are still to be extended, and probably merged with a layout declaration. So let's try that? Knowing that such a change can also remove ambiguity and even introduce new parse errors in existing grammars. Especially owners of highly modular grammars could be in for small surprises. However, in my mind this would be only for grammars that depend on the default implicit layout to go before extend. If people need the old behavior, they can drop this into their bottom modules: What are you thoughts on this @DavyLandman @rodinaarssen @Hassanayo ? |
Yes, I agree, only add default layout in the end, if non of the modules ended up contributing layout. That way you get less surprises, but still enable the case where people didn't specify their layout. |
Ever since I updated the vscode extension of rascal to version 0.11.2, I have been getting ambiguity warnings and errors when I try to test my syntax. I downgraded back to 0.11.1 and it works as it used to. I even tried it with other previous versions of the extension and they work like they should. What could be the cause?
This is a link to a minimal example of what i'm trying to test
https://github.com/Hassanayo/test-expr
There is a file I use to run tests at
The text was updated successfully, but these errors were encountered: