- Clauses
- The only limit on clauses is their arity (the number of arguments to the
head), which is limited to 1024. Raising this limit is easy and
relatively cheap; removing it is harder.
- Atoms and Strings
- SWI-Prolog has no limits on the length of atoms or strings. The number
of atoms is unlimited. Atoms are subject to garbage collection. See
section 12.4.2.1.
Both atoms and strings can represent all Unicode code points, including
0 (
\u0000
). Currently, SWI-Prolog uses a separate
representation for ISO Latin 1 text (code points
0 ... 255) and text that includes higher code points. The
latter is represented using the C wchar_t
type. On most
systems this implies UCS-4, i.e., 32-bit unsigned integers. On Windows
wchar_t
uses UTF-16, which implies that it cannot represent
the code points reserved for surrogate pairs as single code
points. Future versions may switch to using UTF-8 throughout.
- Nesting of terms
- Most built-in predicates that process Prolog terms create an explicitly
managed stack and perform optimization for processing the last argument
of a term. This implies they can process deeply nested terms at constant
and low usage of the C stack, and the system raises a resource error if
no more stack can be allocated. Currently only read/1
and write/1
(and all variations thereof) still use the C stack and may cause the
system to crash in an uncontrolled way (i.e., not mapped to a Prolog
exception that can be caught).
- Integers
- SWI-Prolog has two integer representations. Tagged integers are
currently limited to 57 bits.43Before
version 9.3.6, tagged integers on 32-bit systems had 25 bits and
there was a third representation for 64 bit integers.
Unbounded integers are by default provided by the GNU GMP library.
Alternatively, they may be provided by the bundled LibBf library. The
system can be built without support for unbounded integers.
- Floating point numbers
- Floating point numbers are represented as C-native double precision
floats, 64-bit IEEE on most machines.