triska / ediprolog

Emacs Does Interactive Prolog
https://www.metalevel.at/ediprolog/
37 stars 8 forks source link

Support Trealla #14

Open jgarte opened 4 months ago

jgarte commented 4 months ago

Hi,

Would you accept a patch to add support for trealla in ediprolog?

triska commented 4 months ago

Yes absolutely, it would be great to have support for Trealla, one of the newest Prolog systems, also aiming for conformity to the Prolog ISO standard!

The first consideration should be: What are the main differences between the toplevels of Scryer and Trealla Prolog? If they are largely compatible, then setting ediprolog-system to scryer would work also for Trealla. If there are any differences, then ideally the systems can become more compatible.

The ideal solution is described in #2: Implementing in Prolog a toplevel that is portable between different Prolog systems, so that all systems can be treated identically from within Emacs, even though their default toplevels may differ.

jgarte commented 4 months ago

Would that ediprolog-system variable value then be called iso instead of scryer or something else?

jgarte commented 4 months ago

Seems to work for the true. term in my screenshot above:

image

But it doesn't seem to know about the modules I've imported in my module like clpz 🦆

WDYT?

ediprolog-system is set to scryer and ediprolog-program is set to "/gnu/store/wg2fl6saa1rk0d2ms1js1c57fky6gzw2-trealla-2.53.47/bin/tpl". I packaged trealla for Guix, hence the funny program path.

triska commented 4 months ago

In this example, clpz is imported only locally in your own module, so not directly available from module user. I think it is the same in Scryer.

One way to solve this is to remove the module/2 declaration at the start of the file tetrachords.pl. You can re-add it after development is finished. Then, you can access clpz either by module-qualifying it: clpz:..., or by importing it yourself also at the toplevel, by evaluating the query ?- use_module(library(clpz)).. You then have it available in the module and also on the toplevel.

jgarte commented 4 months ago

Great! That works now using the tpl executable (trealla). Thanks!

image

jgarte commented 4 months ago

Where should we go from here?

2 ?