As already mentioned, the executable files produced by earlier versions of
VB don’t consist of native code. For computers to run these programs, it
is clear that they must entail some extra overhead for the computer to understand
them. Because you have just taken a brief look at how interpreters work, you might
fairly expect to discover that there is an interpreter at the heart of VB. VB
does not, however, rely only on an interpretive mechanism to perform this decoding
at runtime.
Every time you type a new line of code in the VB Code Editor, VB tokenizes
it as a symbol that represents a series of machine instructions. That is, VB doesn’t
compile directly to machine code, but it produces a series of tokens that are
a sort of shorthand for particular operations.
The process of tokenization occurs when an object is regularly represented
by a particular set of signs or symbols. The most familiar form of tokenization
is language. Words are not identical with the things for which they stand—for
instance, the word apple isn’t the same thing as an actual apple—but
words are understood to be tokens for the things they represent.
A programming language such as Visual Basic is a special form of language.
Unlike natural languages, the expressions formed by a programming language literally
can be transformed into the things that they represent. Even though the computer
can’t understand words, programs can be thought of as instructions for a
computer, and certain tools (compilers and linkers) turn words into actual computer
instructions. Think about turning the word apple into an actual apple, and you
begin to see how a programming language is distinct from a natural language such
as English.
When you compile your program, the source code compiles to P-Code, which consists
of a series of these symbols. When you turn your program into an EXE file, VB
builds an executable file that contains the P-Code and the necessary executable
header and startup code. When VB code is compiled, however, you don’t immediately
get actual computer instructions. P-Code itself isn’t executable. If a computer
were told to take the contents of the P-Code literally, it wouldn’t know
what to do.