Programming intro.
  1. Definition
  2. Concepts
  3. Different languages
  4. Source code
  5. Writing programs
  6. Summary

How does source code become a program?

Source code is the actual text used to write the instructions for a computer program, and this text is then translated into something meaningful the computer can understand. But how does this translation process occur?

This tutorial focuses on:

Parsing source code

To 'parse' means to break up into smaller parts. Before source code can be converted into meaningful data for the computer, it has to be parsed. Once this happens, source code is ready for the next step which is compilation.

Compiling source code

Compiling source code refers to turning it into an actual program.

When source code is compiled, it is turned into an actual program (machine code) through a series of steps:

  1. Source code is turned into object code by a compiler
    Object code is the machine code that is actually executed by the computer. A compiler turns source code into object code, but it is not yet ready to become a program. Before object code can become a program, it has to pass through a linker.
  2. Object code is passed through a linker
    A linker is a program that combines various modules and object code files into an executable program. Once the data is passed through a linker, an executable program comes into existence.

NOTE: Machine code is platform specific. So for example, a program that is compiled on Windows will not work on Linux.

Interpreting source code

Interpreting source code refers to turning it into an intermediate form which is executed by a program called an interpreter instead of turning source code directly into machine code like a compiler does.

An interpreter interprets the source code into something that the computer can understand.

Which languages go through which process and why

While code written in any programming language must be parsed, some code is compiled, and some code is interpreted.

Code written in languages used for software development such as C, C++, C#, and Delphi is compiled. These languages are designed to create executable programs, so code written in them needs to be compiled.

Code written in languages used for web development such as Javascript, VBScript, PERL, and PHP is interpreted. These languages are designed to create web applications and display data on web pages, not to create executable programs. So code written in them needs to be interpreted.

It is actually possible to either compile or interpret code written in some high level languages if the circumstances require it. For example, an interpreter is sometimes used during the development stage of a program because the process of compiling a program (if it is a large program) can be time consuming.

© Copyright 2013-2014
Terms of use | Privacy policy | Copyright information