scryer-prolog icon indicating copy to clipboard operation
scryer-prolog copied to clipboard

[user]. Strange end_of_file

Open flexoron opened this issue 1 year ago • 5 comments

?- [user].
en dof ile.
?- % unexpected.

flexoron avatar Jan 11 '24 01:01 flexoron

Wow, I can't imagine how you found this, great catch! It seems it exits for any "terms" with spaces:

?- [user].
a b.
?- [user].
asdf asdf.
?-

I guess the expected behavior is a syntax error.

bakaq avatar Jan 11 '24 02:01 bakaq

Yes(as long as there is no op):

?- op(1,xf,b).
   true.
?- [user].
a b.
?- X b.
   X = a.

flexoron avatar Jan 11 '24 02:01 flexoron

nospace example:

?- [user].
""().
?- % unexpected

flexoron avatar Jan 11 '24 03:01 flexoron

Ideally we could write a fuzzer for this.

bakaq avatar Jan 11 '24 03:01 bakaq

This is specific to [user]. read/1 does not seem to have this problem. The shortest example is

?- [user].
.
?-   % unexpected

UWN avatar Jan 11 '24 05:01 UWN