Reads the next term from Stream and unifies it with Term. Same as:
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)
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, 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: