Programming Languages - Basics

THEcreationist
Hi, programmers. The article is intended for beginning programmers who want know the basics of programming languages.

Programming Language
A programming language is a set of instructions used to communicate with the computer and the set of instructions written in a programming language is called a Program. The programming languages can be broadly categorized as follows:

1. Machine Language:
A machine language is a collection of very detailed cryptic instructions that control computer`s internal circuitry. It is language that a computer actually understands. It is viewed as sequences of 1`s and 0`s that a program written in any language is finally translated to.

2. Low-Level Language:
A low- level language is generally a collection of alphanumeric codes (called mnemonics). E.g. Assembly language uses mnemonics like ADD, SUB etc.
Low-level languages are designed to give good machine efficiency along with some level of user convenience. They are what we call the native code of the Operating system and thus operate at the maximum speed an operating system can provide for program execution (individual programming styles ignored).
Every different type of computer system has its unique instruction set. In fact, the assembly language instructions are dependent on the processor (called microprocessor now) architecture; i.e. an Intel processor will have different instruction set than an AMD processor. So, a low-level program written for one computer may require significant alterations to run on a different computer system. Also, assembly language programming offers low productivity (degree of task achieved per unit time OR per line of code) and makes writing big programs tedious. Due to these reasons, assembly programming is not under common practice.
However, it is an essential skill to learn efficient assembly programming for experienced programmers who design high-performance systems, especially for system programmers and operating system designers, as automatically generated assembly code is not the best optimized for performance and can be manually tweaked to achieve higher performance.

3. High-Level Language:
A high level language is a collection of instructions that resemble human languages. This provides more compatibility of the language with the human thought process. E.g. FORTRAN, BASIC, PASCAL, C, JAVA etc.
High-level languages offer many advantages over low level languages and are thus preferred for program development. Some main advantages are:

Simplicity & Programming Efficiency: Generally, a single instruction in a high-level language corresponds to a set of multiple machine language instructions. This greatly enhances simplicity of program development i.e. leads to higher programming efficiency and productivity.

Uniformity: The rules that apply to the programming, in a particular high-level language, for a particular computer are much the same for other computers also.

Portability: Uniformity supports high degree of portability on computers of same type. Even if the instruction sets of the computers differ, it is the task of the compiler to suit them (see below for compiler) and the rules for programming remain essentially the same i.e. the same program can be run on different computers. Since, portability depends on the compiler of the language (may be available for the instruction set or not) or the libraries accompanying the language, high degree of portability is the benefit provided by only few high-level languages and absolute portability is still a big quest of the day.

Although, nearly whole of the programming world is dominated by the high - level programming languages due to their higher program efficiency and productivity, the assembly language still maintains its place in low level programming and hardware interaction, especially for high performance systems.

4. Middle-Level language:
A middle level of the programming languages is tentatively separated by many programming experts as the class of languages that support features from both strictly high level and strictly low level languages.
A middle level language is designed to have both good programming efficiency and good machine efficiency. These are the class of high level languages that can perform low level programming also, like register manipulation, direct hardware access etc.
C is often classified as a middle level language and its ability to program at low level as well as good programming efficiency makes it a popular choice for implementing Operating Systems.

Language Translators/Processors:
As we have seen above, high level languages are the default choices for program development. But, as we know that the natural dialect of any computer is machine language. So, we need a program that translates a high level program into its corresponding machine language program for execution.
So, language translators are special programs that accept the user program and convert to the corresponding machine instructions. The user program that is written by a user in high level language is called the Source Code and the corresponding machine program is called the Object Code.
Following language translators are generally referred to in the programming world:

1. Compiler:
A compiler translates whole of the source program into corresponding assembly code. Compilers are usually compact and generate small and highly efficient assembly codes. All high level languages use separate compilers of their own.

2. Assembler:
The compiled code has to be processed by an assembler before it is executed. The assembler translates (assembles) whole of the compiled code (assembly program) to the corresponding machine code, which can then be executed.

3. Interpreter:
Interpreters are language translators that proceed with translating and executing single instruction or a group of instructions (usually a line). Generally, Interpreters are less efficient than compilers but are easy to use in program debugging.

Most of the new high level languages like C, Java come with both an interpreter and a compiler of their own.

Published by THEcreationist

A computer engineering student at the Aligarh Muslim University, India. I have always looked to write on variety of topics, especially on creative ways of looking at world. Apart from lots of coding, i have...  View profile

To comment, please sign in to your Yahoo! account, or sign up for a new account.