mthom / scryer-prolog

A modern Prolog implementation written mostly in Rust.
BSD 3-Clause "New" or "Revised" License
1.93k stars 116 forks source link

Answer substitution cannot be parsed as expected #2374

Closed triska closed 2 months ago

triska commented 3 months ago
$ scryer-prolog -f
?- Cs = [ÿ,'Ý','5','Ü',z,'E',è,'\r','Î','À'].
   Cs = "ÿÝ5ÜzEè\rÎÀ".
?- Cs = "ÿÝ5ÜzEè\rÎÀ".
   loops, unexpected.
haijinSk commented 3 months ago

It seems, that is not looping but (unexpected) waiting, so to speak. I can press . or some other key/char + Enter, or only Enter, and get an error message:

?- Chars = "ÿÝ5ÜzEè\rÎÀ".
.
   error(syntax_error(missing_quote),read_term/3:0).

And if the Chars sequence is in a file like for example: test :- Chars = "ÿÝ5ÜzEè\rÎÀ"., I get error(syntax_error(incomplete_reduction),read_term/3:0)., again unexpected.

infradig commented 3 months ago

It's the \r.

triska commented 3 months ago

We could for example also say "It's the Î", because removing it yields:

?- Cs = "ÿÝ5ÜzEè\rÀ".
   Cs = "ÿÝ5ÜzEè\rÀ". % expected

Alternatively, would could for example also say "It's the ÿ and 'Ý'", because removing them yields:

?- Cs = "5ÜzEè\rÎÀ".
   Cs = "5ÜzEè\rÎÀ". % expected

Note that "\r" still occurs in these strings.

triska commented 2 months ago

Thank you a lot!