To write a program (tells what to do) for a computer, we must use Computer Languages. Over the years computer languages have evolved from machine languages to natural languages. The following is the summary of computer languages
1940‘s — Machine Languages
1950‘s — Symbolic Languages
1960‘s — High-Level Languages

Machine Language:-

In the earliest days of computers, the only programming languages available were machine languages. Each computer has its own machine language which is made of streams of 0‘s and 1‘s. The instructions in machine language must be in streams of 0‘s and 1‘s. These are also referred to as binary digits. These are named as the machine can directly understand the programs
Advantages:
1) High-speed execution
2) The computer can understand instructions immediately
3) No translation is needed.

Disadvantages:
1) Machine dependent
2) Programming is very difficult
3) Difficult to understand
4) Difficult to write bug-free programs
5) Difficult to isolate an error

Symbolic Languages (or) Assembly Language:-

In the early 1950‘s Admiral Grace Hopper, a mathematician and naval officer developed the concept of a special computer program that would convert programs into machine language. These early programming languages simply mirrored the machine languages using symbols or mnemonics to represent the various language instructions.

These languages are called symbolic languages. Because a computer does not understand the symbolic language it must be translated into the machine language. A special program called an Assembler translates symbolic code into the machine language. Hence they are Assembly language.
Advantages:
1) Easy to understand and use
2) Easy to modify and isolate the error
3) High efficiency
4) More control on hardware
Disadvantages:
1) Machine Dependent Language
2) Requires translator
3) Difficult to learn and write programs
4) Slow development time
5) Less efficient

High-Level Languages:-

The symbolic languages greatly improved programming efficiency they still required programmers to concentrate on the hardware that they were using working with symbolic languages was also very tedious because each machine instruction had to be individually coded. The desire to improve programmer efficiency and to change the focus from the computer to the problems being solved led to the development of high-level languages.

High-level languages are portable to many different computers allowing the programmer to concentrate on the application problem at hand rather than the intricacies of the computer.

Advantages:
1) Easy to write and understand
2) Easy to isolate an error
3) Machine independent languages
4) Easy to maintain
5) Better readability
6) Low Development cost
7) Easier to document
8) Portable
Disadvantages:
1) Needs translator
2) Requires high execution time
3) Poor control on hardware
4) Less efficient

#include<stdio.h>
void main()
{
   int a,b,c; 
   scanf("%d%d%",&a,&b);
   c=a+b; 
   printf("%d",c);
}

Difference between Machine, Assembly, High-Level Languages:

Language Translators:-

These are the programs that are used for converting the programs in one language into machine language instructions so that they can be executed by the computer.
1) Compiler: It is a program that is used to convert high-level language programs into machine language


2) Assembler: It is a program that is used to convert the assembly level language programs into machine language


3) Interpreter: It is a program, it takes one statement of a high-level language program translates it into machine language instruction, and then immediately executes the resulting machine language instruction, and so on.

Comparison between a Compiler and Interpreter:-

CREATING AND RUNNING PROGRAMS:-

The procedure for turning a program written in C into machine Language. The process is presented in a straightforward, linear fashion but you should recognize that these steps are repeated many times during development to correct errors and make improvements to the code.
The following are the four steps in this process
1) Writing and Editing the program
2) Compiling the program
3) Linking the program with the required modules
4) Executing the program

Writing and Editing Programs:

The software used to write programs is known as a text editor. A text editor helps us enter, change and store character data. Once we write the program in the text editor we save it using a filename stored with an extension of. C. This file is referred to as the source code file.

Compiling Programs:

The code in a source file stored on the disk must be translated into machine language. This is the job of the compiler. The Compiler is a computer program that translates the source code written in a high-level language into the corresponding object code of the low-level language. This translation process is called compilation. The entire high-level program is converted into the executable machine code file. The Compiler which executes C programs is called as C Compiler. Example Turbo C, Borland C, GC, etc., The C Compiler is actually two separate programs: The Preprocessor The Translator
The Preprocessor reads the source code and prepares it for the translator. While preparing the code, it scans for special instructions known as preprocessor commands. These commands tell the preprocessor to look for special code libraries. The result of preprocessing is called the translation unit. After the preprocessor has prepared the code for compilation, the translator does the actual work of converting the program into machine language. The translator reads the translation unit and writes the resulting object module to a file that can then be combined with other pre-compiled units to form the final program. An object module is a code in the machine language

Linking Programs:

The Linker assembles all functions, the program‘s functions, and the system‘s functions into an executable program

Executing Programs:

To execute a program we use an operating system command, such as run, to load the program into primary memory and execute it. Getting the program into memory is the function of an operating system program known as the loader. It locates the executable program and reads it into memory. When everything is loaded the program takes control and it begins execution.

Also Read: Arrays in c++

One comment on “Computer Languages”

Write a comment