Compiling programs (what happens after you click the start arrow?)

If you only speak English, and want to write something a French speaking person can read, someone must translate what you write from English to French:

English text --> Translator --> French text

The translator in that case would be a person who knew both languages well.

Similarly, if you write a program in VB, it must be translated into a language your computer can understand before it can be executed.

Luckily, programming languages like VB are much simpler than natural languages like English and French, so a human translator is not needed. Programming languages are so simple, that we can write computer programs to do the translation from one to another. Computer programs that do such translations are called compilers:

Programming language --> Compiler --> Program the computer can execute

(The use of the term "compiler" instead of "translator" seems to date back to British computing projects at Manchester university in the 1950s).

Many compilers output machine language for a specific CPU. For example, the compiler for VB6, the version of VB that preceded VB.NET, compiled VB into machine language for Intel CPU chips:

VB --> VB6 Compiler --> Intel machine language

VB.NET takes a two step approach. Rather than compiling directly into machine language, the VB.NET compiler outputs a program in an intermediate language called Common Intermediate Language (CIL), and the CIL program is compiled into machine language for the target CPU:

VB --> VB.NET Compiler --> CIL --> CIL compiler --> machine language for the target CPU

This two stage approach has the advantage that an application may be written in any language or even in two or more languages since VB.NET has compilers for other languages than VB:

Any supported language --> Appropriate compiler --> CIL --> CIL compiler --> machine language

The CIL compiler is part of the run-time support that is included with VS.NET. If you do not want to install VS.NET, you can download the runtime support independently and install it on a PC running Windows (not Windows 95). This free download would allow you to execute .NET applications, but you would need VS.NET to develop new ones.

At present, .NET and its languages is only available for Intel CPUs and Windows, but, in the future, Microsoft or others may port the runtime support to other platforms. (See, for example, the Mono project).

You might hear or read the terms source program and object program -- a compiler translates a source program to an object program.

Another term you might encounter is just-in-time compiler which is a compiler, like the CIL compiler above, that compiles to target machine code at the time of execution.

Finally, you may hear of an interpreter as opposed to a compiler. An interpeter translates and executes the programmed instructions one at a time as it goes along, without producing a compiled version. Thus execution begins almost immediately, but if instructions are repeated, they must be retranslated each time.


Disclaimer: The views and opinions expressed on unofficial pages of California State University, Dominguez Hills faculty, staff or students are strictly those of the page authors. The content of these pages has not been reviewed or approved by California State University, Dominguez Hills.