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

DCG compilation: Unexpected warning when using unsupported grammar control construct #2675

Open
triska opened this issue Dec 3, 2024 · 1 comment · May be fixed by #2681
Open

DCG compilation: Unexpected warning when using unsupported grammar control construct #2675

triska opened this issue Dec 3, 2024 · 1 comment · May be fixed by #2681

Comments

@triska
Copy link
Contributor

triska commented Dec 3, 2024

With discontiguous_dcg_error.pl comprising:

:- use_module(library(dcgs)).

d -->
        (   { true } -> []
        ;   { true } -> []
        ).

I get:

$ scryer-prolog -f discontiguous_dcg_error.pl
   error(representation_error(dcg_body),[culprit-({true}->[])]).
% Warning: overwriting -->/2 because the clauses are discontiguous

The error is expected. The warning is unexpected, because the clauses are not discontiguous.

Low priority.

@hurufu
Copy link
Contributor

hurufu commented Dec 4, 2024

I think the root cause is that throwing an exception during term expansion is treated as false by the loader.pl. So when exception is thrown then term is passed to compiler as-is, which then causes the warning. I don't know how to fix it correctly. One solution would be either to remove the offending term, so it wouldn't be compiled at all or change its principal functor to something different...

hurufu added a commit to hurufu/scryer-prolog that referenced this issue Dec 5, 2024
Some DCG constructs aren't supported and can't be expanded, here we
remove offending DCG rule and don't compile it at all – in a similar
fashion to what we do when incorrect goal was found – whole predicate
isn't getting compiled.

Fixes mthom#2675
hurufu added a commit to hurufu/scryer-prolog that referenced this issue Dec 15, 2024
Some DCG constructs aren't supported and can't be expanded, here we
remove offending DCG rule and don't compile it at all – in a similar
fashion to what we do when incorrect goal was found – whole predicate
isn't getting compiled.

Fixes mthom#2675
hurufu added a commit to hurufu/scryer-prolog that referenced this issue Dec 22, 2024
Some DCG constructs aren't supported and can't be expanded, here we
remove offending DCG rule and don't compile it at all – in a similar
fashion to what we do when incorrect goal was found – whole predicate
isn't getting compiled.

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

Successfully merging a pull request may close this issue.

2 participants