-
Notifications
You must be signed in to change notification settings - Fork 6
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
ListNotations
breaks primitive array syntax
#11
Comments
There's also discussion in https://coq.zulipchat.com/#narrow/stream/237977-Coq-users/topic/Notation.20for.20Explicit.20Arrays/near/341669885 :
|
The source of the problem is that we want notations that parse |
As the simplest option, it might be worth changing the syntax for primitive arrays, or just adding alternative options that don't conflict with lists. If you add named constructors, then people could wrap their own notations on top. Primitive arrays are relatively young, after all.
Could the parser left-factor the two rules that start with the
AFAIK, astandard way to have grammar-dependent lexing/scanning is scannerless parsing, that is, drop the lexing and just use a parser; I'm not aware of alternatives (but I'm not a parsing specialist, I just worked with some). The main downside is that LL(1)/LR(1) doesn't suffice in general but you need at least more lookahead (in the Spoofax work from the late Eelco Visser & C, authors argue that in general you need some small extensions over CFGs — that can still be parsed wirh GLR variants); you might get away with less in specific cases (not sure). |
The parser doesn't see the array rule as starting with [, it sees |
Is there a workaround for this issue? Apart from fixing the actual problem it might be worth supporting literal arrays in recursive notation so that people can define their own syntax. Something like Notation "'[arr' x ; .. ; y | d : t ]" := [| x; .. ; y | d : t|]. could be defined before |
Description of the problem
cc @coq/parsing-maintainers
Coq Version
8.17
The text was updated successfully, but these errors were encountered: