The “Read” predicates are
read_term(+Stream, -Term, +Options)
read_term/[2,3] offers many options to return extra information about the
When Prolog reads a term from the current input stream the following conditions must hold:
read/[1,2] does not terminate until the full-stop
is encountered. Thus, if you type at top-level
| ?- read(X)
you will keep getting prompts (first ‘|: ’, and five spaces thereafter) every time you type RET, but nothing else will happen, whatever you type, until you type a full-stop.
term. That is, it does not fail on a syntax error, but perseveres until it eventually manages to read a term. This behavior can be changed with
read_term/[2,3]. See mpg-ref-prolog_flag.
read(X)will cause X to be unified with the atom