A programming language is a language computers use to understand to do what the users of the software want. It is a set of codes and written symbols that provide the platform where computers are instructed to perform certain specific tasks.
A program is a set of sequenced instructions commanding the computer to perform a specific operation or a particular task. It is written in a programming language, which is then converted by a language processor into machine code for the device to perform its tasks.
In order to communicate with the computer user also needs to have a language that should be understood by the computer. For this purpose, Different languages are created to accomplish various types of of work on the computer. Basically, languages are divided into two categories according to their interpretation
- Low level language
- High level language
Low level language
The low level language is the languages closer to the machine language. In low level language each statement is converted to a single machine translation. To write a programs in low level language the programmer must be familiar with instruction set, available set of register and the computer architecture.
Types of love level language
- Machine Level Language
It is programming language at the lowest and most elementary level, and was the first type of programming language to be developed. Machine is basically the only language which computer can understand. In fact , a manufacture designs a computer to obey just one language , its machine code , which is represented inside the computer by a string of binary digits(bits) 0 and 1. The symbol 0 refers to the absence of electric pulse and 1 refers to the presence of an electrical pulse. Since a computer is capable of recognizing electric signals, therefor, it understands machine language.
The following example demonstrates some imaginary instructions in machine code, which adds two numbers 3 and 5.
Real situation: ADD 3 and 5
Machine Code: 100000101 00000011 00000101
Such machine code may be different from machine to machine. So the code is valid for an INTEL processor may not be valid for a MOTOROLA processor.
Merits of Machine language
- It makes fast and efficient uses of the computer.
- Run of code is faster than any other language.
- Lightweight code can be generated.
- It requires no translator to translate the code i.e. its directly understood by computer
Demerits of Machine language
- All operation codes have to be remembered.
- All memory addresses have to be remembered.
- It is hard to amend or find errors in a program written in the machine language.
- These languages are machine dependent i.e. a particular machine language can be used on only one type computer.
- Machine code written for one processor may be incompatible for other. So it is machine dependent and incompatible to all members.
Machine Level Language
Assembly language was developed to overcome some of the many inconveniences of machine language. This is another low-level but very important language in which operation codes and operands are given instead of 0’s and 1’s in the form of alphanumeric symbols.
These alphanumeric symbols are known as mnemonic codes, and can be combined in combinations of up to five letters e.g. ADD for addition, SUB for subtraction. START , LABEL etc. because of this feature, Assembly is also known as ‘symbolic’ programming language.
This is also very difficult and needs a lot of practice to master it because there is only a little English support in this language. In compiler orientations, assembly language is mostly used to aid. A language translator converts the instructions of the assembly language to machine codes and then the computer executes them. Some of the examples of instructions for assembly languages are as follows:
Merits of assembly Level Language
- The symbolic programming of assembly language is easier to understand and saves a lot of time and effort of the programmer.
- It is easier to correct errors and modify program instructions.
- Assembly language has the same efficiency of execution as the machine level language.
Demerits of Assembly level language
- Like ML (Machine Language), it is also machine dependent/specific.
- Since it is machine dependent, the programmer also needs to understand the hardware.
High Level Language
High Level Languages use formats that are similar to English. The purpose of development high-level languages was to enable people to write programs easily; in their own native language environment (English). High-level languages are essentially symbolic languages, using English words and/or mathematical symbols instead of mnemonic codes. Every instruction in the high level language is translated into several instructions in the machine language, which the computer can understand. Examples of high-level languages are PASCAL, C, C++, JAVA, QBASIC etc.
- High-level languages are intended to be machine independent and are problem-oriented language.
- High-level language is also called problem oriented, business oriented and mathematical oriented language.
- High-level language is easily re-locatable.
- The first high level languages released was FORTRAN(formula translation) in 1957.
- Extensive vocabulary of words symbols and sentence.
- Programming is written in languages and whole statement is translated into machine code. Translations is done by special program called compiler.
- Libraries of macros and subroutine can be incorporated.
- A set of rules must be obeyed while writing a source program, which is called syntax.
Table: List of high level programming language
|Beginner`s All-purpose symbolic instruction code.|
|Developed in the mid of 1960s|
|High level programming language|
|First high level language release was FORTAN|
|C programming Language|
|Develop by DENNIS M. RITCHIE in 1970.|
|Used for written any kind of operating and application software, such as UNIX|
|C is middle level language|
|UNIX operating system is written in c language.|
|Object oriented programming language|
|It was developed by Bjarne stroustrup starting in 1979 at bell labs; C++ was originally named C with classes, adding object-oriented features, such as classes, and other enhancements to the C programming language.|
|LISP which means LIST processing is a suitable language for solving non-numeric data processing and is used in the field of the expert system, artificial intelligence and pattern recognition. It was developed by john McCarthy in the early 1960s, at IBM`s Laboratory.|
|Developed by sun microsystems Inc. in 1991, java is a simple and powerful platform independent language. In the web and mobile fields, JAVA has very wide applications|
Types of high-level languages
a. Procedural language (Third generation languages/3GL)
- Also called general-purpose programming language.
- Program statement (also called instructions) resemble English and easier to work with.
- Programming language is machine independent.
- Example: Pascal, COBOL, FORTRAN, PROLOG (Programming Logic). RPG (report Program Generator), LISP (List Processing), ML and Hope which are designed to express the logic, the procedure of a problem.
b. Problem-oriented language (Fourth generation language/4GL)
- Also called specific purpose language/Non-procedural language.
- Mostly database language consists in problem-oriented language.
- Query language and report generator.
- Decision support system (DSS) and financial planning.
- Application generator.
- SQL (Structured query language), QBE (Query by Example), simulation language, Ada, Modula, Modula-2, Coral-66, IRTB (Industrial Real Time Basic).
c. Natural language (Fifth generation languages/5GL)
- Natural languages are still in development state, but they promise to have profound effect particularly in the area of artificial intelligence (AI) and EXPERT SYSTEM, neural network.
- Two popular natural language are : LISP and PROLOG
Merits and Demerits of High Level Language
- High-level languages are user-friendly.
- They are similar to English and use English vocabulary and well-known symbols.
- They are easier to learn.
- They are easier to maintain
- They are problem-oriented rather than ‘machine’-based.
- Machine Independent.
Demerits of Assembly level language
- The object code generated by a translator might be inefficient compared to an equivalent assembly language program.
- Since it is written in human`s language. It becomes heavyweight and execution of the program becomes slower.
- Each system must have its own compiler
Language translator is used to convert the program code written in one language to another language. The program code provided as an input to the language translator is called is known as the source code. The source code is high level or assembly language program.
The language translator that converts the high-level language program called source code into the low-level language program called the object code or the machine language. Compiler, interpreter and assembler are the most common examples of the language translator. While translating the program it checks the syntax that means grammar of the source code at single attempt. If there is a syntax error on source code then compiler produces the syntax error. The source code file must be free from syntax errors for complete compilation process.
Compiler is a computer program that translates code written in high-level languages to a lower level language, object/machine code. The most frequent justification for translating source code is to construct an executable program (converting a high-level language into a computer language).
Advantages of using a compiler
- Source code is not included; therefore, compiled code is more secure than interpreted code.
- Tends to produce faster code than interpreting source code.
- Produces an executable file, and therefore the program can be run without need of the source code.
Disadvantages of using a compiler
- Object code needs to be produced before a final executable file; this can be a slow process.
- The source code must be 100% correct for the executable file to be produces.
Compiler is more efficient and faster than interpreter.A separate compiler is required for each High Level language. For example, a C language compiler cannot translate a program written in JAVA programming language.
- It translates the high-level language program into machine language program into single attempt.
- Compiler converts all the statements in source code to object code and finally it produces executable code in an exe file.
- It finds the syntax error after compiling the whole program.
- It is difficult to trace error and causes of the errors.
- Once compiled the program, it does not need to be recompiled for next run. Therefore, executable programs produced by compilers run much faster and efficient.
- The compiling process is faster than interpreter
- Immediate editing and executing a program is costly process because it takes long time for compilation process if the program is long.
- C,C++,FRORTAN are examples of compiled language.
An interpreter is a language translator which translates high-level language program into machine level language program one instruction at a time. Unlike compiler, it translates one statement of a program, executes the statements immediately and moves to the next statement. When error is encountered in the program, the process of translation is halted and error message is displayed. The programming language such as BASIC, LISP use interpreter.
- It translates high-level language program into machine languages program by one instruction at a time.
- It finds the syntax errors after translating a line of the program at a time.
- It is easy to trace errors and causes of errors.
- The interpreting process is slower than compiler.
- It does not create object file.
- For next running, it is required to repeat the process from the beginning phase, so, it is slower process.
- BASIC and LISP are interpreted language.