Приложения

[Programs and languages]   [Compact discs]   [Computer health]   [Communicating computers]

Programs and languages

Programs (the sets of commands) given to a computer to be carefully written. Otherwise mistakes, known as bugs, can stop the computer from carrying out its job properly. It is important to remember that computers can only follow the instructions they are given. They cannot "see what you mean" or "get the hang of it" as they go along.

Here is a list of instructions for a door-to-door charity collection, written as if it were a program for a robot. Although a human being would have no problem following them, they contain a bug which would leave a computer unable to do the task. Can you spot what it is?

When commanded to go back to stage 1 at stages 3 or 5, the robot finds that it is at a front door already. So it will repeat the cycle, but at the same house. This is obviously not what the programmer meant to happen2. A better command would be: 1.Go to nearest unvisited front door.

Computer-speak

Computers can only read instructions written in binary code. It is possible to write programs straight into binary, but it takes ages and needs seemingly endless rows of Os and 1s.

So computer languages have been developed that use decimal numbers, words and symbols instead. These are then converted by other programs into program into binary code3. There are two main types of program;ming languages: high-level and low-level languages.

High-level languages

High-level languages are the most common type of computer language. They are the easiest to learn because they use words similar to our own.

High-level languages are converted into binary code by using a program called an interpreter, or one called a compiler.

An interpreter works as a program is running. It takes one line of the program's instructions at a time. It checks that the instruction is correct and then it carries it out.

A compiler works before a program is run. It translates all the instructions in the program into binary code at once and then it carries them out.

 

Low-level languages

Low-level languages give a computer instructions in the form of abbreviations. For example, LD may be used for the command "load program", orJMP for "jump".

Computers need a program called an assembler to translate low-level languages into binary code. A disassembler converts binary back into the programming language.

ДАЛЕЕ

[Programs and languages]  [Compact discs]   [Computer health]   [Communicating computers]