TL DR: Do not use get0/1!
get0/1considered obsolete , even by Prolog processors that implement it (for example, SWI).
Instead, use get_char/1and represent strings as not lists of characters like codelists!
< > read_command (Chars): -
get_char (), read_command_aux (Chars, Next).
read_command_aux (Chars, Char): -
member (Char, ['.', '\ t', '\n',
end_of_file],
!, Chars = [].
read_command_aux ([Char | Chars], Char): - get_char (), read_command_aux (Chars, Next).
SWI-Prolog 7.3.15:
?- read_command(Chars).
|: abc
Chars = [a, b, c].
?- read_command(Chars).
|: abc.
Chars = [a, b, c].
?- read_command(Chars).
|: 123abc
Chars = ['1', '2', '3', a, b, c].
, :
< > ? - read_command (Chars),
atom_chars (Command, Chars).
|: abcd.
Chars = [a, b, c, d],
Command = abcd.
, , SWI, SICStus Prolog 4.3.2 ( ).