Programming Languages

Programming languages are formal languages meaning they are designed for a specific purpose. The purpose is to represent mathematical computations with emphasis being made on structure and logic. Before learning any programming language it’s important to know about various types of languages and their features.
The programming languages can be broadly classified into two categories:
1. Low level languages
2. High level languages

Low Level Languages
As the name indicates these are closer to the computing hardware. Low level programs being near to “bare metal” of the processor, they are the fastest in terms of execution.The languages in this category are,

  1. Machine Level Language
    Computer is a digital system which can only understand digital signals, which are binary digits i.e. 0 and 1. Hence the instructions given to the computer can only be in binary codes. The machine language consists of instructions that are in binary 0 or 1. Computers can understand only machine level language.
    > Very difficult for programmers to write instructions in binary code.
    > A machine level program is error-prone and its maintenance is very difficult.
    > Machine level programs are not portable. Every computer has its own machine instructions, so the programs written for one computer are not valid for other computers.
  2. Assembly Language
    The drawbacks of machine level language were reduced to some extent by using a modified form of machine level language called assembly language. In assembly language the instructions are given in English like words such as MOV, ADD, SUB etc. Therefore it became easier to read and understand assembly programs.
    Since the computer can only understand the machine level language, it became necessary to translate the assembly program into the machine code(opcode). The translator is called “assembler“. This translation adds a small overhead to the program execution time but it’s negligible.                                                           Drawbacks:                                                                                                                                   > Programmer has to know all the lower level details related to the computer hardware.
    > Because the data in assembly programs stored in computer registers and each computer has different set of registers, assembly language is also not portable.

High Level Languages
High level languages are designed keeping portability in mind i.e. these languages are machine independent.These languages are close to natural languages such as English, so it’s easy to write and understand the programs in high-level languages. When programming in a high level language the programmer is not concerned with the low level details, and hence the entire attention can be paid to the logic of the problem being solved.
For translating a high level program into machine level instructions compiler or interpreter is used. Every high level language has its own compiler or interpreter.
Almost all the languages we learn and use to program today belong to this category.      Eg: C,C++,Java, Python, FORTRAN, COBOL, BASIC, Pascal etc.

As we know by now the programs need to be in machine level language for a computer to execute it. Any other form of the program requires translation into machine level. To achieve this translators are used. The translators themselves are computer programs which accept a program written in a high-level or low-level language and produce an equivalent machine language program as output. There are three types of translators:

  1. Assembler: Assembler converts the code of low-level language (assembly language) into machine level language.
  2. Compiler: A compiler converts an high-level language code into machine level language. The high level program is called “source code” and the corresponding machine level code an “object code“.
    The compiler searches for errors in the program and lists them. If the program is error free, it converts the program into object code all at once. The converted object code is ready to run as many times on as many different computers (assuming same architecture) as you want.
  3. Interpreter: An interpreter does what the compiler does meaning it converts an high-level program (source code) into the machine level code (object code). But it does so one program statement at a time, meaning it converts only one program statement into its object code and executes it immediately before converting the next statement in the source code. This process continues till the last statement of the program or an erroneous statement occurs.

About Deepak Devanand

Seeker of knowledge
This entry was posted in C and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s