How Programming Languages Work

[ LiB ]

How Programming Languages Work

Let's ignore Webster and Oxford and pretend that the word language simply refers to a system used to communicate. Languages possess syntax , and syntax defines the order, arrangement, or structure of the system of communication.

This book is written in English, a language sometimes referred to as American or Present-Day English, which evolved from the Early Modern, Middle, and Old English languages. Some historians and linguists claim that forms of English can be traced through Gothic, Latin, and Greek, eventually finding roots in Sanskrit (see Figure 1.1).

Figure 1.1. A comparison between English and computer language roots


If you trace programming languages back to their source, you'll find that all computers, or at least their CPUs, have an internal machine language that they execute directly. Internally, all data in a modern digital computer is stored as binary on and off states. The tools used to manipulate these on/off states are coded in a binary representation and normally consist of operation codes and addresses. The operation code indicates which operation is to be carried out, while the address dictates the memory location. The operation basically amounts to what, and the address basically amounts to where. This process looks something like Table 1.1. Given the operation codes and address in Table 1.1, a programmer can enter in the instructions in pure binary form as:

 00100010 10010101 

Table 1.1. Sample Machine Language Instructions



English Translation



means "load(X)"

Address Location


means "location 13" on the CPU

These instructions would load X into location 13. As you can imagine, it is very tedious to write this way. A programmer needs to be especially careful to keep track of which address locations he is using to store data; program errors often lead to operations overwriting the wrong addresses.

Programming languages express these operations and addresses at a higher level of logic than the low-level CPU code. They are translation systems that allow a computer and a person to communicate with each other in a medium that is something between English and CPU binary. With a programming language, a person can program what actions a computer will take and the types of data the program acts upon without having to speak the computer's language.

CPU is an abbreviation for central processing unit . Often referred to as the processor or central processor , the CPU performs most of a computer's calculations. CPUs are normally one or more printed circuit boards , but may be housed in a single chip called a microprocessor . CPUs typically consist of an Arithmetic Logic Unit (ALU) that performs logical operations and a Control Unit that extracts instructions from memory and decodes and executes them.

[ LiB ]

Game Programming with Pyton, Lua and Ruby
Game Programming with Pyton, Lua and Ruby
Year: 2005
Pages: 133 © 2008-2017.
If you may any questions please contact us: