Reads the next term from Stream and unifies it with Term. Same as:
read_term(Stream, Term, )
stream_object, must be ground
A valid Prolog input stream.
The term to be read.
Term must be followed by a full-stop. The full-stop is removed from the input stream and is not a part of the term that is read. The term is read with respect to current operator declarations.
Does not finish until the full-stop is encountered. Thus, if you type at top level
| ?- read(X)
then 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.
If a syntax error is encountered, then the action taken depends on the
current value of the
syntax_errors Prolog flag.
If the end of the current input stream has been reached, then
Term will be unified with the atom
read/[1,2] for the same stream will then raise an
exception, unless the stream is connected to the terminal. The
characters read are subject to character-conversion.
Stream errors (see ref-iou-sfh-est), plus:
A syntax error was found.