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

Feature Request: DCG Translation with Unification Spillling #665

Open
Jean-Luc-Picard-2021 opened this issue Jan 25, 2025 · 1 comment
Open

Comments

@Jean-Luc-Picard-2021
Copy link

Lets say there are at least two unification spilling rewriting techniques
in a Prolog system that would eliminate a (=)/2 call:

/* Left Spilling into the Head */
p(V, Q) :- V = T, ...         ~~>            p(T, Q) :- ...

/* Right Spilling into a Goal */
..., V = T, p(V, Q), ...      ~~>            ..., p(T, Q), ... 

I find that Trealla Prolog does neither nor:

/* Trealla Prolog 2.63.33 */
p --> [a], !, [b].

?- listing(p/2).
p(A,B) :-
   A=[a|C],(!,C=D),D=[b|B].

I made a little experiment introducing both left spilling and right
spilling into a DCG translator, which previously had neither:

/* Dogelog Player 1.3.0 */
?- listing(p/2).
p([a|A], B) :-
   !,
   A = [b|B].

Now my benchmark suite DCG calculator runs 25% faster!

Source:

calc.p.log

@infradig
Copy link
Contributor

infradig commented Feb 3, 2025

If it's library/dcgs.pl at issue then i'm not messing with it.

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

No branches or pull requests

2 participants