ciao-lang / ciao

Ciao is a modern Prolog implementation that builds up from a logic-based simple kernel designed to be portable, extensible, and modular.
https://ciao-lang.org
GNU Lesser General Public License v3.0
262 stars 20 forks source link

Readline without rlwrap #13

Open suhr opened 4 years ago

suhr commented 4 years ago

Is it possible to have a readline interface in ciaosh without rlwrapping the command?

jfmc commented 4 years ago

Linking with readline is currently not implemented, but it does not seem very complicated. Would there be some advantage in readline lib vs rlwrapping? rlwrap was added as a quick fix to enhance Ciao usage from a terminal when outside Emacs.

suhr commented 4 years ago

It would be definitely much more convenient for people who do not use Emacs.

jfmc commented 4 years ago

The command ciao without arguments starts ciaosh under rlwrap (if available). Would it be enough? We'd like to know if there is some missing feature in the rlwrap solution.

suhr commented 4 years ago

We'd like to know if there is some missing feature in the rlwrap solution.

Actually there is. If you enter

?- X = (1,
2).

then there will be two queries in the history: X = (1, and 2).. The reason is simple: rlwrap knows nothing about Prolog syntax, it understands only lines.

By contrast, this is exactly one query in swipl.

jfmc commented 4 years ago

Thanks! That is a good motivation.

I had a look and plugging it into the Ciao toplevel is not straightforward (e.g., proper interaction between readline input and the term parser for queries). I'll keep this issue open until there is some progress.