Computer Programming/Highlevel

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Computer languages come in many flavors. Generally there are high-level and low-level languages. The term "language level" is an attempt to convey information about how close the programming language is to the machine language of the particular hardware. Low-level languages are closer to the machine language, and high-level languages are further away from machine language, and close to natural languages (e.g., English).

An extreme example of a low-level language is the machine language which consists of ones and zeros. It is extremely rare (difficult, and error prone), however, for people to write programs in machine language. The closest programming language to machine language is assembly language, which normally has one instruction, or statement, for each machine language instruction. An example of the kind of instruction that exists in assembly language is to copy the contents of a particular memory address into a machine register.

One example of a high-level computer language might be Visual Basic/VB6, where the language is programmed by the user with specific words which can be found in the English dictionary.

Any language (computer or natural) still must have certain structures, though. English sentences are made of English words which are combined to respect the grammar (i.e., the structure) of English. We understand a sentence if the grammar is (more or less) correct. However, just because a high-level language uses some words which seem to be natural English does not mean that the computer can directly understand English sentences as we would speak them to a person. A program must be written to respect the structure (grammar) of the computer language used, if the computer is to understand. Typically the grammar of a computer language is more rigid than the grammar of a natural language.