-
Notifications
You must be signed in to change notification settings - Fork 13
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
DCG body won't parse \+
#602
Comments
I cannot answer your question because I'm not that much into DCG yet.
|
This is a dcgs.pl (@UWN) issue as it also present here...
|
As per dcgs.pl line 181 negation is implementation defined, and the common implementation does not allow it. SWI-Prolog I believe does. |
SWI 9.2.7 accepts the input (\+ "a") but does not answer false which is expected I guess: Correction: SWI requires list notation: |
Yes it is. There are several issues here. Note that we are talking about the grammar control construct The first is whether or not this construct should be supported. At first
If an implementation now decides to not support this construct, there are two possibilities, only the second is conforming. One is just to provide no translation for For Scryer/Trealla, that is all you need to know. And if an implementation decides to support
So this error is only detected at the point in time of executing the goal. Not earlier on. In the past, some implementations did convert the argument of For all related cases of conformity see #27 and the following. |
Thanks for the answers everybody, I see now why
Does this mean there is a way to write a DCG that accomplishes the same thing (e.g. don't match a prefix AND match these other rules), without using |
You can always supply your own definition for a non-terminal. That is, another non-terminal. |
Thanks @UWN. I think this works:
|
Very close!
See |
... er, I was a little bit too quick. Just an ordinary |
That is very interesting, thank you! I was wondering why prolog couldn't generate more than one solution for this DCG. E.G:
But using
|
Excuse me, @dnmfarrell. Hope you don't mind that I mention it again GNU Prolog (and SWI and ECLiPSe) accepting both versions of your program:
Which one? |
This DCG matches any list not beginning with a:
Is this intentional? Is there another way to negate a DCG rule?
The text was updated successfully, but these errors were encountered: