Term representation

A term is represented by a word containing a value and a tag. The tag distinguishes the type of the term. Floating-point numbers are represented as special structures in the form of $float(I1,I2,I3) where I1, I2 and I3 are integers.

The value of a term is an address except when the term is an integer (in this case, the value represents the integer itself). The address points to a different location depending on the type of the term. The address in a reference points to the referenced term. An unbound variable is represented by a self-referencing pointer. The address in an atom points to the record for the atom symbol in the symbol table. The address in a structure $f(t_1,\ldots,t_n)$ points to a block of $n+1$ consecutive words where the first word points to the record for the functor f/n in the symbol table and the remaining n words store the components of the structure. The address in a list [H$\vert$T] points to a block of two consecutive words where the first word stores the car H and the second word stores the cdr T.

Neng-Fa Zhou 2012-01-03