[ Predicate Database and Compiler | Reference Manual | Alphabetic Index ]

compile_stream(+Stream)

Compile the given stream Stream with default options
Stream
Stream handle or alias (atom)

Description

Compile from an (already opened) input stream with default options. The resulting code is directly loaded into memory and ready for execution. Equivalent to
	compile(stream(Stream), [])
    
Stream may be a stream handle or a reserved or user-defined symbolic stream name. The stream can be of any type, e.g. file, tty, socket, queue, string, etc.

If Stream is an opened input stream, its content is read and compiled as in compile/1. The compilation stops at the stream end, but the stream remains open.

Modes and Determinism

Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

Exceptions

(4) instantiation fault
Stream is not instantiated.
(5) type error
Stream is instantiated, but not to an atom or stream handle.
(192) illegal stream mode
Stream is in an illegal stream mode.
(193) illegal stream specification
Stream is an illegal stream specification.

Examples

compile_string(String) :-
	open(string(String), read, S),
	compile_stream(S),
	close(S).


Error:
     compile_stream(X).      (Error 4).
     compile_stream(1.0).    (Error 5).
     compile_stream(1).      (Error 192).
     compile_stream(2).      (Error 192).
     compile_stream(20).     (Error 192).
     compile_stream(a).      (Error 193).

See Also

compile / 1, compile / 2, compile_term / 1, pragma / 1