This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
 MATHEMATICA TUTORIAL

# Basic Internal Architecture

 numbers sequences of binary digits strings sequences of character code bytes or byte pairs symbols pointers to the central table of symbols general expressions sequences of pointers to the head and elements

Internal representations used by Mathematica.

When you type input into Mathematica, a data structure is created in the memory of your computer to represent the expression you have entered.
In general, different pieces of your expression will be stored at different places in memory. Thus, for example, for a list such as the "backbone" of the list will be stored at one place, while each of the actual elements will be stored at a different place.
The backbone of the list then consists just of three "pointers" that specify the addresses in computer memory at which the actual expressions that form the elements of the list are to be found. These expressions then in turn contain pointers to their subexpressions. The chain of pointers ends when one reaches an object, such as a number or a string, which is stored directly as a pattern of bits in computer memory.
Crucial to the operation of Mathematica is the notion of symbols such as . Whenever appears in an expression, Mathematica represents it by a pointer. But the pointer is always to the same place in computer memory—an entry in a central table of all symbols defined in your Mathematica session.
This table is a repository of all information about each symbol. It contains a pointer to a string giving the symbol's name, as well as pointers to expressions that give rules for evaluating the symbol.
 • Recycle memory as soon as the data in it is no longer referenced.

The basic principle of Mathematica memory management.

Every piece of memory used by Mathematica maintains a count of how many pointers currently point to it. When this count drops to zero, Mathematica knows that the piece of memory is no longer being referenced, and immediately makes the piece of memory available for something new.
This strategy essentially ensures that no memory is ever wasted, and that any piece of memory that Mathematica uses is actually storing data that you need to access in your Mathematica session.
 • Create an expression corresponding to the input you have given. • Process the expression using all rules known for the objects in it. • Generate output corresponding to the resulting expression.

The basic actions of Mathematica.

At the heart of Mathematica is a conceptually simple procedure known as the evaluator, which takes every function that appears in an expression and evaluates that function.
When the function is one of the thousand or so that are built into Mathematica, what the evaluator does is to execute directly internal code in the Mathematica system. This code is set up to perform the operations corresponding to the function, and then to build a new expression representing the result.
 • The built-in functions of Mathematica support universal computation.

The basic feature that makes Mathematica a self-contained system.

A crucial feature of the built-in functions in Mathematica is that they support universal computation. What this means is that out of these functions you can construct programs that perform absolutely any kinds of operations that are possible for a computer.
As it turns out, small subsets of Mathematica's built-in functions would be quite sufficient to support universal computation. But having the whole collection of functions makes it in practice easier to construct the programs one needs.
The underlying point, however, is that because Mathematica supports universal computation you never have to modify its built-in functions: all you have to do to perform a particular task is to combine these functions in an appropriate way.
Universal computation is the basis for all standard computer languages. But many of these languages rely on the idea of compilation. If you use C or Fortran, for example, you first write your program, then you compile it to generate machine code that can actually be executed on your computer.
Mathematica does not require you to go through the compilation step: once you have input an expression, the functions in the expression can immediately be executed.
Often Mathematica will preprocess expressions that you enter, arranging things so that subsequent execution will be as efficient as possible. But such preprocessing never affects the results that are generated, and can rarely be seen explicitly.